code: def histogram(a, bins):
      
      if any(map(lambda x: x < 0, diff(bins))):
          raise ValueError(
              'bins must increase monotonically.')
  
      try:
          sa = sorted(a)
      except TypeError:
          # Perhaps just a single value? Treat as a list and carry on
          sa = sorted([a])
  
      # import numpy as np
      # nl = np.searchsorted(sa, bins[:-1], 'left')
      # nr = np.searchsorted(sa, bins[-1], 'right')
      # nn = np.r_[nl, nr]
      #
      # # cl = list(accumulate(Counter(map(lambda x: bisect_left(bins[:-1], x), sa)))
      # # print("cl")
      # # print([cl[i] for i in range(len(bins))])
      # print("nl")
      # print(list(nl))
      # # print(Counter(map(lambda x: bisect_right([bins[-1]], x), sa)))
      # print("nr")
      # print([nr])
      # print("nn")
      # print(list(nn))
      # print("hist")
      # print(list(np.diff(nn)))
      # print(list(np.histogram(a, bins)[0]))
  
      nl = list(accumulate([Counter(map(lambda x: bisect_left(bins[:-1], x), sa))[i] for i in range(len(bins) - 1)]))
      # print("nl")
      # print(nl)
      nr = Counter(map(lambda x: bisect_right([bins[1]], x), sa))[1]
      # print(nl)
      # print(nr)
      n = list(nl) + [nr]
  
      return diff(n), bins
docs: Compute the histogram of a set of data.
  
      :param a: Input data
      :param bins: int or sequence of scalars or str, optional
      :type a: list | tuple
      :type bins: int | list[int] | list[str]
      :return: