docs: def from_data(source):
      """Infers a table/view schema from its JSON representation, a list of records, or a Pandas
         dataframe.
  
      Args:
        source: the Pandas Dataframe, a dictionary representing a record, a list of heterogeneous
            data (record) or homogeneous data (list of records) from which to infer the schema, or
            a definition of the schema as a list of dictionaries with 'name' and 'type' entries
            and possibly 'mode' and 'description' entries. Only used if no data argument was provided.
            'mode' can be 'NULLABLE', 'REQUIRED' or 'REPEATED'. For the allowed types, see:
            https://cloud.google.com/bigquery/preparing-data-for-bigquery#datatypes
  
            Note that there is potential ambiguity when passing a list of lists or a list of
            dicts between whether that should be treated as a list of records or a single record
            that is a list. The heuristic used is to check the length of the entries in the
            list; if they are equal then a list of records is assumed. To avoid this ambiguity
            you can instead use the Schema.from_record method which assumes a single record,
            in either list of values or dictionary of key-values form.
  
      Returns:
        A Schema for the data.
      """
      if isinstance(source, pandas.DataFrame):
        bq_schema = Schema._from_dataframe(source)
      elif isinstance(source, list):
        if len(source) == 0:
          bq_schema = source
        elif all(isinstance(d, dict) for d in source):
          if all('name' in d and 'type' in d for d in source):
            # It looks like a bq_schema; use it as-is.
            bq_schema = source
          elif all(len(d) == len(source[0]) for d in source):
            bq_schema = Schema._from_dict_record(source[0])
          else:
            raise Exception(('Cannot create a schema from heterogeneous list %s; perhaps you meant ' +
                            'to use Schema.from_record?') % str(source))
        elif isinstance(source[0], list) and \
                all([isinstance(l, list) and len(l) == len(source[0]) for l in source]):
          # A list of lists all of the same length; treat first entry as a list record.
          bq_schema = Schema._from_record(source[0])
        else:
          # A heterogeneous list; treat as a record.
          raise Exception(('Cannot create a schema from heterogeneous list %s; perhaps you meant ' +
                          'to use Schema.from_record?') % str(source))
      elif isinstance(source, dict):
        raise Exception(('Cannot create a schema from dict %s; perhaps you meant to use ' +
                        'Schema.from_record?') % str(source))
      else:
        raise Exception('Cannot create a schema from %s' % str(source))
      return Schema(bq_schema)