code: def powerset(l):
      """
      Generates all subsets of list `l` (as tuples).
  
      Example
      -------
      >>> from pgmpy.utils.mathext import powerset
      >>> list(powerset([1,2,3]))
      [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
      """
      return chain.from_iterable(
          combinations(l, r) for r in range(len(l) + 1)
      )
  
file_path: pgmpy/pgmpy/utils/mathext.py
imports: from collections import namedtuple
  from itertools import chain, combinations
  import numpy
  from pgmpy import config
  from pgmpy.global_vars import logger
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 5 for calling a global function with example usage: powerset(l) and returns: chain