def convert_list_to_sql_tuple(filter_list):

    """ This function takes a list and formats it into a SQL list that can be used
    to filter on in the WHERE clause. For example, ['a', 'b'] becomes ('a', 'b') and
    can be applied as: SELECT * FROM table WHERE column IN ('a', 'b').

    Note that any pre-formatting on the list has to happen before it is passed to this
    function. Typical steps can include flattening lists and/or casting all elements to
    the same type.
    """

    if isinstance(filter_list, list):
        return str(filter_list).replace('[', '(').replace(']', ')')
    else:
        raise TypeError('convert_list_to_sql_tuple() must be passed a list!')