def sql_number_list(target):
    """
    Returns a list of numbers suitable for placement after the SQL IN operator in
    a query statement, as in "(1, 2, 3)".
    """
    if not target:
        raise ValueError
    elif not isinstance(target, list):
        target = [target]

    return "(%s)" % (", ".join(["%d" % (i,) for i in target]))