code: def _read_filepattern(
      filepattern, max_lines=None, split_on_newlines=True
  ):
      """Reads files matching a wildcard pattern, yielding the contents.
  
      Args:
        filepattern: A wildcard pattern matching one or more files.
        max_lines: If set, stop reading after reading this many lines.
        split_on_newlines: A boolean. If true, then split files by lines and strip
            leading and trailing whitespace from each line. Otherwise, treat each
            file as a single string.
  
      Yields:
        The contents of the files as lines, if split_on_newlines is True, or
        the entire contents of each file if False.
      """
      filenames = sorted(tf.io.gfile.glob(filepattern))
      lines_read = 0
      for filename in filenames:
          with tf.io.gfile.GFile(filename) as f:
              if split_on_newlines:
                  for line in f:
                      yield line.strip()
                      lines_read += 1
                      if max_lines and lines_read >= max_lines:
                          return
  
              else:
                  if max_lines:
                      doc = []
                      for line in f:
                          doc.append(line)
                          lines_read += 1
                          if max_lines and lines_read >= max_lines:
                              yield "".join(doc)
                              return
                      yield "".join(doc)
  
                  else:
                      yield f.read()
  
file_path: trax/trax/data/tokenizer.py
imports: import collections
  import sys
  import unicodedata
  from absl import logging
  import six
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: _read_filepattern(filepattern, max_lines, split_on_newlines) without return types