code: def _filter_requirements(
      lines_iter, filter_names=None, filter_sys_version=False
  ):
      for line in lines_iter:
          line = line.strip()
          if not line or line.startswith("#"):
              continue
  
          match = REQ_PATTERN.match(line)
          if match is None:
              raise AssertionError(
                  "Could not parse requirement: '%s'" % line
              )
  
          name = match.group("name")
          if filter_names is not None and name not in filter_names:
              continue
  
          if filter_sys_version and match.group("pyspec"):
              pycomp, pyspec = match.group("pycomp", "pyspec")
              comp = STR_TO_CMP[pycomp]
              pyver_spec = StrictVersion(pyspec)
              if comp(SYS_VERSION, pyver_spec):
                  # pip install -r understands lines with ;python_version<'3.0',
                  # but pip install -e does not.  Filter here, removing the
                  # env marker.
                  yield line.split(";")[0]
              continue
  
          yield line
  
imports: from __future__ import print_function
  import os
  import re
  import sys
  from operator import lt, gt, eq, le, ge
  from os.path import abspath, dirname, join
  from distutils.version import StrictVersion
  from setuptools import Extension, find_packages, setup
  import versioneer
label_desc: Use image node_id 2 for calling a global function with example usage: _filter_requirements(lines_iter, filter_names, filter_sys_version) without return types