code: def check(varname: str, value, expected_types: list):
      """One-liner syntactic sugar for checking types.
  
      It can also check callables.
  
      Examples:
          ```python
          check('x', x, [int, float])
          ```
  
      Args:
          varname: The name of the variable (for diagnostic error message).
          value: The value of the `varname`.
          expected_types: The type(s) the item is expected to be.
  
      Raises:
          TypeError: If data is not the expected type.
      """
      is_expected_type: bool = False
      for t in expected_types:
          if t is callable:
              is_expected_type = t(value)
          else:
              is_expected_type = isinstance(value, t)
          if is_expected_type:
              break
  
      if not is_expected_type:
          raise TypeError(
              f"{varname} should be one of {expected_types}."
          )
  
imports: from __future__ import annotations
  import importlib
  import os
  import socket
  import sys
  from functools import singledispatch, wraps
  from pathlib import Path
  from typing import Any, Callable, Dict, Iterable, List, Union
  from warnings import warn
  import numpy
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: check(varname, value, expected_types) without return types