def maybe_declare(entity, channel=None, retry=False, **retry_policy):
 is_bound = entity.is_bound
 orig = entity
 if (not is_bound):
  assert channel
  entity = entity.bind(channel)
 if (channel is None):
  assert is_bound
  channel = entity.channel
 declared = ident = None
 if (channel.connection and entity.can_cache_declaration):
  declared = channel.connection.client.declared_entities
  ident = hash(entity)
  if (ident in declared):
   return False
 if retry:
  return _imaybe_declare(entity, declared, ident, channel, orig, **retry_policy)
 return _maybe_declare(entity, declared, ident, channel, orig)

def maybe_declare ( entity , channel = None , retry = False , ** retry_policy ) : is_bound = entity . is_bound orig = entity if ( not is_bound ) : assert channel entity = entity . bind ( channel ) if ( channel is None ) : assert is_bound channel = entity . channel declared = ident = None if ( channel . connection and entity . can_cache_declaration ) : declared = channel . connection . client . declared_entities ident = hash ( entity ) if ( ident in declared ) : return False if retry : return _imaybe_declare ( entity , declared , ident , channel , orig , ** retry_policy ) return _maybe_declare ( entity , declared , ident , channel , orig )
declare entity .