code: def _parse_event_files_spec(logdir_spec):
      """Parses `logdir_spec` into a map from paths to run group names.
  
      The `--logdir_spec` flag format is a comma-separated list of path
      specifications. A path spec looks like 'group_name:/path/to/directory' or
      '/path/to/directory'; in the latter case, the group is unnamed. Group names
      cannot start with a forward slash: /foo:bar/baz will be interpreted as a spec
      with no name and path '/foo:bar/baz'.
  
      Globs are not supported.
  
      Args:
        logdir: A comma-separated list of run specifications.
      Returns:
        A dict mapping directory paths to names like {'/path/to/directory': 'name'}.
        Groups without an explicit name are named after their path. If logdir is
        None, returns an empty dict, which is helpful for testing things that don't
        require any valid runs.
      """
      files = {}
      if logdir_spec is None:
          return files
      # Make sure keeping consistent with ParseURI in core/lib/io/path.cc
      uri_pattern = re.compile("[a-zA-Z][0-9a-zA-Z.]*://.*")
      for specification in logdir_spec.split(","):
          # Check if the spec contains group. A spec start with xyz:// is regarded as
          # URI path spec instead of group spec. If the spec looks like /foo:bar/baz,
          # then we assume it's a path with a colon. If the spec looks like
          # [a-zA-z]:\foo then we assume its a Windows path and not a single letter
          # group
          if (
              uri_pattern.match(specification) is None
              and ":" in specification
              and specification[0] != "/"
              and not os.path.splitdrive(specification)[0]
          ):
              # We split at most once so run_name:/path:with/a/colon will work.
              run_name, _, path = specification.partition(":")
          else:
              run_name = None
              path = specification
          if uri_pattern.match(path) is None:
              path = os.path.realpath(os.path.expanduser(path))
          files[path] = run_name
      return files
  
imports: import os
  import re
  import threading
  import time
  from tensorboard.backend.event_processing import data_provider
  from tensorboard.backend.event_processing import plugin_event_multiplexer
  from tensorboard.backend.event_processing import tag_types
  from tensorboard.compat import tf
  from tensorboard.data import ingester
  from tensorboard.plugins.audio import metadata
  from tensorboard.plugins.histogram import metadata
  from tensorboard.plugins.image import metadata
  from tensorboard.plugins.pr_curve import metadata
  from tensorboard.plugins.scalar import metadata
  from tensorboard.util import tb_logging
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_event_files_spec(logdir_spec) and returns: files, files