def METHOD_NAME(url):
    """
    Get the scheme from a URL, if the URL is valid.
    Parameters:
        url: A :term:`native string`.
    Returns:
        The scheme of the url as a :term:`native string`, or ``None`` if the
        URL was invalid.
    """
    try:
        return urlparse(url).scheme
    except ValueError:
        return None