import re


def url_get_scheme( url, clean=False ):
    """
    Given a URL it returns the scheme.
    If clean is 'True', it returns the scheme without '://'.
    If there is not scheme it will return 'None'.
    """

    # Regular Expression to get the scheme
    scheme_pattern = "^.*://"
    res = re.search( scheme_pattern, url )
    scheme = None

    # If something has been found get it
    if res != None:
        scheme = res.group()

        if clean:
            scheme = scheme[:-3]

    return scheme