code: def get_cwd(options):
      
      if not options.cwd:
          return None
      if not os.path.exists(options.cwd):
          raise exceptions.InvalidCwd(
              "can't --cwd to invalid path {0!r}".format(options.cwd))
      return options.cwd
docs: Discover what directory the command should run in.