code: def expand (self, user=False, vars=False, glob=False, resolve=False):
          
          from os import path
          from glob import glob
  
          text = text_type (self)
          if user:
              text = path.expanduser (text)
          if vars:
              text = path.expandvars (text)
          if glob:
              results = glob (text)
              if len (results) == 1:
                  text = results[0]
              elif len (results) > 1:
                  raise IOError ('glob of %r should\'ve returned 0 or 1 matches; got %d'
                                 % (text, len (results)))
  
          other = self.__class__ (text)
          if resolve:
              other = other.resolve ()
  
          return other
docs: Return a new :class:`Path` with various expansions performed. All
  	expansions are disabled by default but can be enabled by passing in
  	true values in the keyword arguments.
  
  	user : bool (default False)
  	  Expand ``~`` and ``~user`` home-directory constructs. If a username is
  	  unmatched or ``$HOME`` is unset, no change is made. Calls
  	  :func:`os.path.expanduser`.
  	vars : bool (default False)
  	  Expand ``$var`` and ``${var}`` environment variable constructs. Unknown
  	  variables are not substituted. Calls :func:`os.path.expandvars`.
  	glob : bool (default False)
  	  Evaluate the path as a :mod:`glob` expression and use the matched path.
  	  If the glob does not match anything, do not change anything. If the
  	  glob matches more than one path, raise an :exc:`IOError`.
  	resolve : bool (default False)
  	  Call :meth:`resolve` on the return value before returning it.