code: def metadata_to_intermediary(metadata):
      
      tables = [table_to_intermediary(table) for table in metadata.tables.values()]
      relationships = [relation_to_intermediary(fk) for table in metadata.tables.values() for fk in table.foreign_keys]
      return tables, relationships
docs: Transforms SQLAlchemy metadata to the intermediary representation.