code: def to_data(interval, conv=None, pinf=float('inf'), ninf=float('-inf')):
      
      interval = Interval(interval) if isinstance(interval, AtomicInterval) else interval
      conv = (lambda v: v) if conv is None else conv
  
      data = []
  
      def _convert(bound):
          if bound == inf:
              return pinf
          elif bound == -inf:
              return ninf
          else:
              return conv(bound)
  
      for item in interval:
          data.append((
              item.left,
              _convert(item.lower),
              _convert(item.upper),
              item.right
          ))
      return data
docs: Export given interval (or atomic interval) to a list of 4-uples (left, lower,
      upper, right).
  
      :param interval: an Interval or AtomicInterval instance.
      :param conv: function that convert bounds to "lower" and "upper", default to identity.
      :param pinf: value used to encode positive infinity.
      :param ninf: value used to encode negative infinity.
      :return: a list of 4-uples (left, lower, upper, right)