import re


def humansorted_datasets(l, key=None):
    """Sort a list of datasets according to a key of a dataset

    Parameters
    ----------
    l : list
        The list of datasets to be sorted
    key : str (optional)
        The key of the dataset the datasets should be sorted according to.
        Defaults to 'name'.

    Returns
    -------
    list
        The sorted list of datasets.
    """
    key = key or 'name'
    def alphanum_key(s):
        key = re.split(r'(\d+)', s)
        key[1::2] = map(int, key[1::2])
        return key
    def alphanum_dataset(d):
        s = d[key]
        return alphanum_key(s)
    return sorted(l, key=alphanum_dataset)