def iri_to_uri(iri):
 if (iri is None):
  return iri
 return quote(force_bytes(iri), safe="/#%[]=:;$&()+,!?*@'~")

def iri_to_uri ( iri ) : if ( iri is None ) : return iri return quote ( force_bytes ( iri ) , safe = "/#%[]=:;$&()+,!?*@'~" )
converts any unicode based iri to an acceptable ascii uri .