<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_config( cls, obj, selectable, ingredient_constructor=ingredient_from_validated_dict, metadata=None ):
 """Create a shelf using a dict shelf definition. :param obj: A Python dictionary describing a Shelf. :param selectable: A SQLAlchemy Table, a Recipe, a table name, or a SQLAlchemy join to select from. :param metadata: If `selectable` is passed as a table name, then in order to introspect its schema, we must have the SQLAlchemy MetaData object to associate it with. :return: A shelf that contains the ingredients defined in obj. """

        from recipe import Recipe
        if isinstance(selectable, Recipe):
            selectable = selectable.subquery()
        elif isinstance(selectable, basestring):
            if '.' in selectable:
                schema, tablename = selectable.split('.')
            else:
                schema, tablename = None, selectable

            selectable = Table(
                tablename,
                metadata,
                schema=schema,
                extend_existing=True,
                autoload=True
            )

        d = {}
        for k, v in iteritems(obj):
            d[k] = ingredient_constructor(v, selectable)
        shelf = cls(d, select_from=selectable)
        return shelf