code: def pbag(elements):
      """
      Convert an iterable to a persistent bag.
  
      Takes an iterable with elements to insert.
  
      >>> pbag([1, 2, 3, 2])
      pbag([1, 2, 2, 3])
      """
      if not elements:
          return _EMPTY_PBAG
      return PBag(reduce(_add_to_counters, elements, pmap()))
  
imports: from collections.abc import Container, Iterable, Sized, Hashable
  from functools import reduce
  from typing import Generic, TypeVar
  from pyrsistent._pmap import pmap
label_desc: Use image node_id 3 for calling a global function with example usage: pbag(elements) and returns: PBag, _EMPTY_PBAG