def splitport(host):
 global _portprog
 if (_portprog is None):
  import re
  _portprog = re.compile('^(.*):([0-9]*)$')
 match = _portprog.match(host)
 if match:
  (host, port) = match.groups()
  if port:
   return (host, port)
 return (host, None)

def splitport ( host ) : global _portprog if ( _portprog is None ) : import re _portprog = re . compile ( '^(.*):([0-9]*)$' ) match = _portprog . match ( host ) if match : ( host , port ) = match . groups ( ) if port : return ( host , port ) return ( host , None )
splitport --> host .