def get_list_from_arg(arg, valid):
    """
    Helper function to that validates a list against a valid set.
    :param arg: A string to compare against valid.
    :param valid: A list of valid values.
    :return: list of validated values.
    """
    arg_split = arg.split(",")

    if 'all' in arg_split:
        return ['all']
    else:
        result = []

        for arg in arg_split:
            if arg in valid:
                result += [arg]
        return result