code: def deepcopy_sqla_object(startobj: object,
                           session: Session,
                           flush: bool = True,
                           debug: bool = False,
                           debug_walk: bool = False,
                           debug_rewrite_rel: bool = False,
                           objmap: Dict[object, object] = None) -> object:
      
      if objmap is None:
          objmap = {}  # keys = old objects, values = new objects
      deepcopy_sqla_objects(
          startobjs=[startobj],
          session=session,
          flush=flush,
          debug=debug,
          debug_walk=debug_walk,
          debug_rewrite_rel=debug_rewrite_rel,
          objmap=objmap
      )
      return objmap[startobj]
docs: Makes a copy of the object, inserting it into ``session``.
  
      Uses :func:`deepcopy_sqla_objects` (q.v.).
  
      A problem is the creation of duplicate dependency objects if you call it
      repeatedly.
  
      Optionally, if you pass the objmap in (which maps old to new objects), you
      can call this function repeatedly to clone a related set of objects...
      ... no, that doesn't really work, as it doesn't visit parents before
      children. The :func:`cardinal_pythonlib.sqlalchemy.merge_db.merge_db`
      function does that properly.
  
      Args:
          startobj: SQLAlchemy ORM object to deep-copy
          session: see :func:`deepcopy_sqla_objects`
          flush: see :func:`deepcopy_sqla_objects`
          debug: see :func:`deepcopy_sqla_objects`
          debug_walk: see :func:`deepcopy_sqla_objects`
          debug_rewrite_rel: see :func:`deepcopy_sqla_objects`
          objmap: see :func:`deepcopy_sqla_objects`
  
      Returns:
          the copied object matching ``startobj``