def __check_list(data, varname=None, dtype=None):
    """
    Checks if data is a list of dtype or turns a variable of dtype into a list

    Args:
        data:
            Data to check

        varname (str):
            Name of variable to check

        dtype (type)
            Data type to check data against
    Returns:
        list(dtype)
    """

    if type(data) == dtype:
        return [data]

    if type(data) == list:
        for elem in data:
            if not type(elem) == dtype:
                if varname:
                    raise ValueError('All entries for {} must be {}.'.format(str(varname), str(dtype)))
        return data

    raise ValueError('{} is not the correct type.'.format(str(varname)))