#NEWLINE# def is_safe_uri( self , uri ) : #NEWLINE# #INDENT# "Determine whether the given URI is to be considered safe for\n        inclusion in the output.\n        \n        The default implementation checks whether the scheme of the URI is in\n        the set of allowed URIs (`safe_schemes`).\n        \n        >>> sanitizer = HTMLSanitizer()\n        >>> sanitizer.is_safe_uri('http://example.org/')\n        True\n        >>> sanitizer.is_safe_uri('javascript:alert(document.cookie)')\n        False\n        \n        :param uri: the URI to check\n        :return: `True` if the URI can be considered safe, `False` otherwise\n        :rtype: `bool`\n        :since: version 0.4.3\n        " #NEWLINE# if ( '#' in uri ) : #NEWLINE# #INDENT# uri = uri . split ( '#' , 1 ) [ 0 ] #NEWLINE# #UNINDENT# if ( ':' not in uri ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# chars = [ char for char in uri . split ( ':' , 1 ) [ 0 ] if char . isalnum ( ) ] #NEWLINE# return ( '' . join ( chars ) . lower ( ) in char . safe_schemes )