code: def create_database_session(engine):
      
  
      try:
          Session = sessionmaker(bind=engine)
          return Session()
      except OperationalError as e:
          raise DatabaseError(error=e.orig.args[1], code=e.orig.args[0])
docs: Connect to the database