code: def parse_rrule(component, tz=UTC):
      
      if component.get('rrule'):
          # component['rrule'] can be both a scalar and a list
          rrules = component['rrule']
          if not isinstance(rrules, list):
              rrules = [rrules]
  
          # Since DTSTART are always made timezone aware, UNTIL with no tzinfo
          # must be converted to UTC.
          for rule in rrules:
              until = rule.get("until")
              for idx, dt in enumerate(until or []):
                  if not hasattr(dt, 'tzinfo'):
                      until[idx] = normalize(normalize(dt, tz=tz), tz=UTC)
  
          # Parse the rrules, might return a rruleset instance, instead of rrule
          rule = rrulestr('\n'.join(x.to_ical().decode() for x in rrules), dtstart=normalize(component['dtstart'].dt, tz=tz))
          
          if component.get('exdate'):
              # Make sure, to work with a rruleset
              if isinstance(rule, rrule):
                  rules = rruleset()
                  rules.rrule(rule)
                  rule = rules
              
              # Add exdates to the rruleset
              for exd in extract_exdates(component):
                  rule.exdate(exd)
          
          #TODO: What about rdates and exrules?
          
      # You really want an rrule for a component without rrule? Here you are.
      else:
          rule = rruleset()
          rule.rdate(normalize(component['dtstart'].dt, tz=tz))
      
      return rule
docs: Extract a dateutil.rrule object from an icalendar component. Also includes
      the component's dtstart and exdate properties. The rdate and exrule
      properties are not yet supported.
      
      :param component: icalendar component
      :param tz: timezone for DST handling
      :return: extracted rrule or rruleset