code: def parse_requirements_file(
      path, allowed_extras: set = None, include_all_extra: bool = True
  ):
      requirements = []
      extras = defaultdict(list)
      with open(path) as requirements_file:
          import re
  
          def fix_url_dependencies(req: str) -> str:
              """Pip and setuptools disagree about how URL dependencies should be handled."""
              m = re.match(
                  r"^(git\+)?(https|ssh)://(git@)?github\.com/([\w-]+)/(?P<name>[\w-]+)\.git",
                  req,
              )
              if m is None:
                  return req
              else:
                  return f"{m.group('name')} @ {req}"
  
          for line in requirements_file:
              line = line.strip()
              if line.startswith("#") or len(line) <= 0:
                  continue
              req, *needed_by = line.split("# needed by:")
              req = fix_url_dependencies(req.strip())
              if needed_by:
                  for extra in needed_by[0].strip().split(","):
                      extra = extra.strip()
                      if (
                          allowed_extras is not None
                          and extra not in allowed_extras
                      ):
                          raise ValueError(
                              f"invalid extra '{extra}' in {path}"
                          )
                      extras[extra].append(req)
                  if include_all_extra and req not in extras["all"]:
                      extras["all"].append(req)
              else:
                  requirements.append(req)
      return requirements, extras
  
label_desc: Use image node_id 1 for calling a global function with example usage: parse_requirements_file(path, allowed_extras, include_all_extra) and returns: requirements,  extras, req, m, str, req