def add_extension(module, name, code):
 code = int(code)
 if (not (1 <= code <= 2147483647)):
  raise ValueError, 'code out of range'
 key = (module, name)
 if ((_extension_registry.get(key) == code) and (_inverted_registry.get(code) == key)):
  return
 if (key in _extension_registry):
  raise ValueError(('key %s is already registered with code %s' % (key, _extension_registry[key])))
 if (code in _inverted_registry):
  raise ValueError(('code %s is already in use for key %s' % (code, _inverted_registry[code])))
 _extension_registry[key] = code
 _inverted_registry[code] = key

def add_extension ( module , name , code ) : code = int ( code ) if ( not ( 1 <= code <= 2147483647 ) ) : raise ValueError , 'code out of range' key = ( module , name ) if ( ( _extension_registry . get ( key ) == code ) and ( _inverted_registry . get ( code ) == key ) ) : return if ( key in _extension_registry ) : raise ValueError ( ( 'key %s is already registered with code %s' % ( key , _extension_registry [ key ] ) ) ) if ( code in _inverted_registry ) : raise ValueError ( ( 'code %s is already in use for key %s' % ( code , _inverted_registry [ code ] ) ) ) _extension_registry [ key ] = code _inverted_registry [ code ] = key
register an extension code .