Handle general to SQL conversion.

    :param func: function to be called on the given definition
    :param definition_dict: statement definition in dict
    :param definition_kwargs: statement definition as kwargs
    :return: raw SQL statement

def any2sql(func, definition_dict=None, **definition_kwargs):
    """Handle general to SQL conversion.

    :param func: function to be called on the given definition
    :param definition_dict: statement definition in dict
    :param definition_kwargs: statement definition as kwargs
    :return: raw SQL statement
    """
    if definition_dict and definition_kwargs:
        raise InputError("Cannot process dict and kwargs input at the same time")

    definition = load_input(definition_dict or definition_kwargs)

    if definition.get('returning', '') == '*':
        definition['returning'] = mosql_raw('*')

    try:
        result = func(**definition)
    except (TypeError, AttributeError) as exc:
        raise ClauseError("Clause definition error: %s" % str(exc)) from exc
    except Exception as exc:
        import json2sql.errors as json2sql_errors

        if exc.__class__.__name__ not in json2sql_errors.__dict__.keys():
            raise json2sql_errors.Json2SqlInternalError("Unhandled error: %s" % str(exc)) from exc
        raise

    return result