def register_with(registry):
    """
    Register a passed in object.

    Intended to be used as a decorator on model building functions with a
    ``dict`` as a registry.

    Examples
    --------
    .. code-block:: python

        REGISTRY = dict()
        @register_with(REGISTRY)
        def build_empty(base):
            return base

    """
    def decorator(func):
        registry[func.__name__] = func
        return func
    return decorator