def as_dependency(self, maybe_dependency):
        """ Adapts an object into the `piped.resource.IDependency` interface.

        :raises: An exception may be raised if the object has a registered
            adapter, but the adapter raised an exception in its __init__.
        :rtype: An object implementing `piped.resource.IDependency`
        """
        try:
            dependency = IDependency(maybe_dependency)
        except TypeError, te:
            if 'Could not adapt' not in te.args:
                raise
            # if we cannot adapt the object, we consider it an instance dependency.
            dependency = self._get_instance_dependency(maybe_dependency)
        return dependency
dataset/ETHPy150Open foundit/Piped/piped/dependencies.py/DependencyManager.as_dependency/original