code: def group_files(
      files_to_sort,
      reader=None,
      time_threshold=10,
      group_keys=None,
      reader_kwargs=None,
      missing="pass",
  ):
      """Group series of files by file pattern information.
  
      By default this will group files by their filename ``start_time``
      assuming it exists in the pattern. By passing the individual
      dictionaries returned by this function to the Scene classes'
      ``filenames``, a series `Scene` objects can be easily created.
  
      Args:
          files_to_sort (iterable): File paths to sort in to group
          reader (str or Collection[str]): Reader or readers whose file patterns
              should be used to sort files.  If not given, try all readers (slow,
              adding a list of readers is strongly recommended).
          time_threshold (int): Number of seconds used to consider time elements
              in a group as being equal. For example, if the 'start_time' item
              is used to group files then any time within `time_threshold`
              seconds of the first file's 'start_time' will be seen as occurring
              at the same time.
          group_keys (list or tuple): File pattern information to use to group
              files. Keys are sorted in order and only the first key is used when
              comparing datetime elements with `time_threshold` (see above). This
              means it is recommended that datetime values should only come from
              the first key in ``group_keys``. Otherwise, there is a good chance
              that files will not be grouped properly (datetimes being barely
              unequal). Defaults to a reader's ``group_keys`` configuration (set
              in YAML), otherwise ``('start_time',)``.  When passing multiple
              readers, passing group_keys is strongly recommended as the
              behaviour without doing so is undefined.
          reader_kwargs (dict): Additional keyword arguments to pass to reader
              creation.
          missing (str): Parameter to control the behavior in the scenario where
              multiple readers were passed, but at least one group does not have
              files associated with every reader.  Valid values are ``"pass"``
              (the default), ``"skip"``, and ``"raise"``.  If set to ``"pass"``,
              groups are passed as-is.  Some groups may have zero files for some
              readers.  If set to ``"skip"``, groups for which one or more
              readers have zero files are skipped (meaning that some files may
              not be associated to any group).  If set to ``"raise"``, raise a
              `FileNotFoundError` in case there are any groups for which one or
              more readers have no files associated.
  
      Returns:
          List of dictionaries mapping 'reader' to a list of filenames.
          Each of these dictionaries can be passed as ``filenames`` to
          a `Scene` object.
  
      """
      if reader is not None and not isinstance(reader, (list, tuple)):
          reader = [reader]
  
      reader_kwargs = reader_kwargs or {}
  
      reader_files = _assign_files_to_readers(
          files_to_sort, reader, reader_kwargs
      )
  
      if reader is None:
          reader = reader_files.keys()
  
      file_keys = _get_file_keys_for_reader_files(
          reader_files, group_keys=group_keys
      )
  
      file_groups = _get_sorted_file_groups(file_keys, time_threshold)
  
      groups = [
          {rn: file_groups[group_key].get(rn, []) for rn in reader}
          for group_key in file_groups
      ]
  
      return list(_filter_groups(groups, missing=missing))
  
imports: from __future__ import annotations
  import logging
  import os
  import pathlib
  import pickle
  import warnings
  from datetime import datetime, timedelta
  from functools import total_ordering
  import yaml
  from yaml import UnsafeLoader
  from satpy._config import config_search_paths, get_entry_points_config_dirs, glob_config
  from .yaml_reader import AbstractYAMLReader
  from .yaml_reader import load_yaml_configs
label_desc: Use image node_id 1 for calling a global function with example usage: group_files(files_to_sort, reader, time_threshold, group_keys, reader_kwargs, missing) and returns: list