code: def valid_path(value):
      "Validate a cookie path ASCII string"
      # Generate UnicodeDecodeError if path can't store as ASCII.
      value.encode("ascii")
      # Cookies without leading slash will likely be ignored, raise ASAP.
      if not (value and value[0] == "/"):
          return False
      if not Definitions.PATH_RE.match(value):
          return False
      return Truf valid_path(value):
      "Validate a cookie path ASCII string"
      # Generate UnicodeDecodeError if path can't store as ASCII.
      value.encode("ascii")
      # Cookies without leading slash will likely be ignored, raise ASAP.
      if not (value and value[0] == "/"):
          return False
      if not Definitions.PATH_RE.match(value):
          return False
      return True
docs: Validate a cookie path ASCII string