code: def df(objs, labels: Optional[List[str]] = None):
      """
      Create pandas DataFrame from the sequence of same-type objects.
  
      Args:
        labels: If supplied, retain only the given labels and drop the rest.
      """
      import pandas as pd
      from .objects import DynamicObject
  
      if objs:
          objs = list(objs)
          obj = objs[0]
          if is_dataclass(obj):
              df = pd.DataFrame.from_records(
                  dataclassAsTuple(o) for o in objs
              )
              df.columns = [field.name for field in fields(obj)]
          elif isinstance(obj, DynamicObject):
              df = pd.DataFrame.from_records(o.__dict__ for o in objs)
          else:
              df = pd.DataFrame.from_records(objs)
          if isinstance(obj, tuple):
              _fields = getattr(obj, "_fields", None)
              if _fields:
                  # assume it's a namedtuple
                  df.columns = _fields
      else:
          df = None
      if labels:
          exclude = [label for label in df if label not in labels]
          df = df.drop(exclude, axis=1)
      return df
  
imports: import asyncio
  import datetime
  import logging
  import math
  import signal
  import sys
  import time
  from dataclasses import fields, is_dataclass
  from typing import AsyncIterator, Awaitable, Callable, Iterator, List, Optional, Union
  import eventkit
label_desc: Use image node_id 1 for calling a global function with example usage: df(objs, labels) and returns: df