code: def _parse(
      flavor,
      io,
      match,
      attrs,
      encoding,
      displayed_only,
      extract_links,
      **kwargs,
  ):
      flavor = _validate_flavor(flavor)
      compiled_match = re.compile(
          match
      )  # you can pass a compiled regex here
  
      retained = None
      for flav in flavor:
          parser = _parser_dispatch(flav)
          p = parser(
              io,
              compiled_match,
              attrs,
              encoding,
              displayed_only,
              extract_links,
          )
  
          try:
              tables = p.parse_tables()
          except ValueError as caught:
              # if `io` is an io-like object, check if it's seekable
              # and try to rewind it before trying the next parser
              if hasattr(io, "seekable") and io.seekable():
                  io.seek(0)
              elif hasattr(io, "seekable") and not io.seekable():
                  # if we couldn't rewind it, let the user know
                  raise ValueError(
                      f"The flavor {flav} failed to parse your input. "
                      "Since you passed a non-rewindable file "
                      "object, we can't rewind it to try "
                      "another parser. Try read_html() with a different flavor."
                  ) from caught
  
              retained = caught
          else:
              break
      else:
          assert retained is not None  # for mypy
          raise retained
  
      ret = []
      for table in tables:
          try:
              df = _data_to_frame(data=table, **kwargs)
              # Cast MultiIndex header to an Index of tuples when extracting header
              # links and replace nan with None (therefore can't use mi.to_flat_index()).
              # This maintains consistency of selection (e.g. df.columns.str[1])
              if extract_links in ("all", "header") and isinstance(
                  df.columns, MultiIndex
              ):
                  df.columns = Index(
                      (
                          (col[0], None if isna(col[1]) else col[1])
                          for col in df.columns
                      ),
                      tupleize_cols=False,
                  )
  
              ret.append(df)
          except EmptyDataError:  # empty table
              continue
      return ret
  
imports: from __future__ import annotations
  from collections import abc
  import numbers
  import re
  from typing import TYPE_CHECKING, Iterable, Literal, Pattern, Sequence, cast
  from pandas._libs import lib
  from pandas._typing import BaseBuffer, DtypeBackend, FilePath, ReadBuffer
  from pandas.compat._optional import import_optional_dependency
  from pandas.errors import AbstractMethodError, EmptyDataError
  from pandas.util._validators import check_dtype_backend
  from pandas.core.dtypes.common import is_list_like
  from pandas import isna
  from pandas.core.indexes.base import Index
  from pandas.core.indexes.multi import MultiIndex
  from pandas.core.series import Series
  from pandas.io.common import file_exists, get_handle, is_url, stringify_path, urlopen, validate_header_arg
  from pandas.io.formats.printing import pprint_thing
  from pandas.io.parsers import TextParser
label_desc: Use image node_id 11 for calling a global function with example usage: _parse(flavor, io, match, attrs, encoding, displayed_only, extract_links) and returns: ret