code: def get_by_token(token: str) -> Optional[User]:
      user_key = UserTokenIndex.get(token)
  
      if user_key:
          u: User = user_key.load()
          if u.tokens[token] > time.time():
              return u
  
          if token in u.session_token_owners:
              for session in u.session_token_owners[token]:
                  UserSessionTokenIndex.delete(session)
                  if session in u.session_tokens:
                      del u.session_tokens[session]
              del u.session_token_owners[token]
          del u.tokens[token]
          UserTokenIndex.delete(token)
          u.save()
          return None
      return None
  
imports: import time
  from labml_db import Model, Key, Index
  from typing import List, Dict, Optional, Set, Any
  from .None import project
  from ..None import utils
  from ..utils import gen_token
label_desc: Use image node_id 5 for calling a global function with example usage: get_by_token(token) and returns: None, None, u