def account_or_none(target, cls, email_address):
 shard_id = (target << 48)
 with session_scope(shard_id) as db_session:
  try:
   account = db_session.query(cls).filter((cls.email_address == email_address)).one()
  except NoResultFound:
   return
  db_session.expunge(account)
 return account

def account_or_none ( target , cls , email_address ) : shard_id = ( target << 48 ) with session_scope ( shard_id ) as db_session : try : account = db_session . query ( cls ) . filter ( ( cls . email_address == email_address ) ) . one ( ) except NoResultFound : return db_session . expunge ( account ) return account
query the target shard to determine if an account with the given provider and email_address exists .