code: def to_bedtool(iterator):
      
      def gen():
          for i in iterator:
              yield helpers.asinterval(i)
      return pybedtools.BedTool(gen())
docs: Convert any iterator into a pybedtools.BedTool object.
  
      Note that the supplied iterator is not consumed by this function. To save
      to a temp file or to a known location, use the `.saveas()` method of the
      returned BedTool object.