def tometadata(self, metadata, schema=RETAIN_SCHEMA,
                   referred_schema_fn=None):

        if schema is RETAIN_SCHEMA:
            schema = self.schema
        elif schema is None:
            schema = metadata.schema
        key = _get_table_key(self.name, schema)
        if key in metadata.tables:
            util.warn("Table '%s' already exists within the given "
                      "MetaData - not copying." % self.description)
            return metadata.tables[key]

        args = []
        for c in self.columns:
            args.append(c.copy(schema=schema))
        table = Table(
            self.name, metadata, schema=schema,
            *args, **self.kwargs
        )
        for c in self.constraints:
            if isinstance(c, ForeignKeyConstraint):
                referred_schema = c._referred_schema
                if referred_schema_fn:
                    fk_constraint_schema = referred_schema_fn(
                        self, schema, c, referred_schema)
                else:
                    fk_constraint_schema = (
                        schema if referred_schema == self.schema else None)
                table.append_constraint(
                    c.copy(schema=fk_constraint_schema, target_table=table))

            else:
                table.append_constraint(
                    c.copy(schema=schema, target_table=table))
        for index in self.indexes:
            # skip indexes that would be generated
            # by the 'index' flag on Column
            if len(index.columns) == 1 and \
                    list(index.columns)[0].index:
                continue
            Index(index.name,
                  unique=index.unique,
                  *[table.c[col] for col in index.columns.keys()],
                  **index.kwargs)
        return self._schema_item_copy(table)
Return a copy of this :class:`.Table` associated with a different
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/sql/schema.py/Table.tometadata