code: def _data_to_frame(**kwargs):
      head, body, foot = kwargs.pop("data")
      header = kwargs.pop("header")
      kwargs["skiprows"] = _get_skiprows(kwargs["skiprows"])
      if head:
          body = head + body
  
          # Infer header when there is a <thead> or top <th>-only rows
          if header is None:
              if len(head) == 1:
                  header = 0
              else:
                  # ignore all-empty-text rows
                  header = [
                      i
                      for i, row in enumerate(head)
                      if any(text for text in row)
                  ]
  
      if foot:
          body += foot
  
      # fill out elements of body that are "ragged"
      _expand_elements(body)
      with TextParser(body, header=header, **kwargs) as tp:
          return tp.read()
  
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 7 for calling a global function with example usage: _data_to_frame() and returns: tp