code: def find_phase(self, obj):
          r
          # If received phase, just return self
          if obj._isa('phase'):
              return obj
          # If phase happens to be in settings (i.e. algorithm), look it up
          if 'phase' in obj.settings.keys():
              phase = self.phases()[obj.settings['phase']]
              return phase
          # Otherwise find it using bottom-up approach (i.e. look in phase keys)
          for phase in self.phases().values():
              if ('pore.'+obj.name in phase) or ('throat.'+obj.name in phase):
                  return phase
          # If all else fails, throw an exception
          raise Exception('Cannot find a phase associated with '+obj.name)
docs: r"""
          Find the Phase associated with a given object.
  
          Parameters
          ----------
          obj : OpenPNM Object
              Can either be a Physics or Algorithm object
  
          Returns
          -------
          An OpenPNM Phase object.
  
          Raises
          ------
          If no Phase object can be found, then an Exception is raised.