<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def AutomaticShelf(table):
 """Given a SQLAlchemy Table, automatically generate a Shelf with metrics and dimensions based on its schema. """

    if hasattr(table, '__table__'):
        table = table.__table__
    config = introspect_table(table)
    return Shelf.from_config(config, table)