docs: def load(filename, ureg='pimms'):
      '''
      pimms.load(filename) loads a pimms-formatted save-file from the given filename, which may
        optionaly be a string. By default, this function forces all quantities (via the pint
        module) to be loaded using the pimms.units unit registry; the option ureg can change
        this.
  
      If the filename is not a correctly formatted pimms save-file, an error is raised.
  
      Options:
        * ureg ('pimms') specifies the unit-registry to use for ping module units that are loaded
          from the files; 'pimms' is equivalent to pimms.units. None is equivalent to using the
          pint._APP_REGISTRY unit registry.
      '''
      if ureg is not None:
          if ureg == 'pimms': ureg = units
          orig_app_ureg = pint._APP_REGISTRY
          orig_dfl_ureg = pint._DEFAULT_REGISTRY
          pint._APP_REGISTRY = ureg
          pint._DEFAULT_REGISTRY = ureg
          try:    return load(filename, ureg=None)
          except: raise
          finally:
              pint._APP_REGISTRY     = orig_app_ureg
              pint._DEFAULT_REGISTRY = orig_dfl_ureg
      if isinstance(filename, six.string_types):
          filename = os.path.expanduser(filename)
          with open(filename, 'rb') as f:
              return _load_stream(f)
      else:
          return _load_stream(filename)