def _sort_list_dict_by(ld_name=None, keyname=None):
    """sort a list of dictionaries by key.

    Parameters
    ----------
    ld_name: list[dict]
        list of dictionaries
    keyname: str
        dictionary key to use for sorting
    """
    if (ld_name is None or not isinstance(ld_name, list)):
        raise TypeError("Expected list of dictionaries")
    return sorted(ld_name, key=lambda k: k[keyname])