def METHOD_NAME(query, **kwargs):
    """
    django.utils.http.urlencode wrapper that replaces query parameter values
    of None with empty string so that urlencode doesn't raise TypeError
    "Cannot encode None in a query string".
    """
    # sequence of 2-element tuples
    if isinstance(query, (list, tuple)):
        query_seq = ((pair[0], "" if pair[1] is None else pair[1]) for pair in query)
        return urlencode(query_seq, **kwargs)
    elif isinstance(query, dict):
        query_d = {k: "" if v is None else v for k, v in query.items()}
        return urlencode(query_d, **kwargs)
    else:
        return urlencode(query, **kwargs)