def ensure_scheme(url, default_scheme='<STR_LIT:http>'):
parsed = urlsplit(url, scheme=default_scheme)<EOL>if not parsed.netloc:<EOL><INDENT>parsed = SplitResult(<EOL>scheme=parsed.scheme,<EOL>netloc=parsed.path,<EOL>path='<STR_LIT>',<EOL>query=parsed.query,<EOL>fragment=parsed.fragment<EOL>)<EOL><DEDENT>return urlunsplit(parsed)<EOL>
Adds a scheme to a url if not present.

    Args:
        url (string): a url, assumed to start with netloc
        default_scheme (string): a scheme to be added

    Returns:
        string: URL with a scheme