code: def filter_flags(parsed_flags, valid_flags):
      
      def valid_argv(argv):
          """Figures out if a flag parsed from the flagfile matches a flag in
          the command about to be run."""
          flagname_match = FLAG_RE.match(argv)
          if not flagname_match:
              return True
          flagname = flagname_match.group()
          return flagname in valid_flags
      return list(filter(valid_argv, parsed_flags))
docs: Return the subset of `parsed_flags` that are found in the list `valid_flags`