def sortListsInDict(data, reverse=False):
    """Recursively loops through a dictionary and sorts all lists.

    Args:
      data(dict): data dictionary
      reverse: (Default value = False)

    Returns:
      : dict -- sorted dictionary

    """
    if isinstance(data, list):
        if not data:
            return data

        if isinstance(data[0], dict):
            if all('name' in elem for elem in data):
                return sorted(data, key=lambda k: k['name'], reverse=reverse)
        elif isinstance(data[0], str):
            return sorted(data, reverse=reverse)
        return data
    elif isinstance(data, dict):
        return {key: sortListsInDict(value, reverse) for key, value in data.items()}
    else:  # any other type, such as string
        return data