def sortByName(requestContext, seriesList, natural=False):
    """
    Takes one metric or a wildcard seriesList.

    Sorts the list of metrics by the metric name using either alphabetical
    order or natural sorting. Natural sorting allows names containing numbers
    to be sorted more naturally, e.g:

    - Alphabetical sorting: server1, server11, server12, server2
    - Natural sorting: server1, server2, server11, server12

    """
    if natural:
        return list(sorted(seriesList, key=lambda x: paddedName(x.name)))
    else:
        return list(sorted(seriesList, key=lambda x: x.name))

    Takes one metric or a wildcard seriesList.

    Sorts the list of metrics by the metric name using either alphabetical
    order or natural sorting. Natural sorting allows names containing numbers
    to be sorted more naturally, e.g:

    - Alphabetical sorting: server1, server11, server12, server2
    - Natural sorting: server1, server2, server11, server12

    
graphite_api/functions.py