code: def build_range(dateTime, frequency):
      assert isinstance(frequency, int)
      assert frequency > 1
  
      if frequency < bar.Frequency.DAY:
          ret = IntraDayRange(dateTime, frequency)
      elif frequency == bar.Frequency.DAY:
          ret = DayRange(dateTime)
      elif frequency == bar.Frequency.MONTH:
          ret = MonthRange(dateTime)
      else:
          raise Exception("Unsupported frequency")
      return ret
  
imports: import abc
  import datetime
  import six
  from pyalgotrade.utils import dt
  from pyalgotrade import bar
label_desc: Use image node_id 2 for calling a global function with example usage: build_range(dateTime, frequency) and returns: ret