code: def get_engine_name(ec=None):
      
      ec = ec or __default_engine__
      if isinstance(ec, (str, unicode)):
          return ec
      elif isinstance(ec, Session):
          return ec.engine_name
      else:
          raise Error("Parameter ec should be an engine_name or Session object, but %r found" % ec)
docs: Get the name of a engine or session