docs: def add_event(
      request,
      template='swingtime/add_event.html',
      event_form_class=forms.EventForm,
      recurrence_form_class=forms.MultipleOccurrenceForm
  ):
      '''
      Add a new ``Event`` instance and 1 or more associated ``Occurrence``s.
  
      Context parameters:
  
      ``dtstart``
          a datetime.datetime object representing the GET request value if present,
          otherwise None
  
      ``event_form``
          a form object for updating the event
  
      ``recurrence_form``
          a form object for adding occurrences
  
      '''
      dtstart = None
      if request.method == 'POST':
          event_form = event_form_class(request.POST)
          recurrence_form = recurrence_form_class(request.POST)
          if event_form.is_valid() and recurrence_form.is_valid():
              event = event_form.save()
              recurrence_form.save(event)
              return http.HttpResponseRedirect(event.get_absolute_url())
  
      else:
          if 'dtstart' in request.GET:
              try:
                  dtstart = parser.parse(request.GET['dtstart'])
              except(TypeError, ValueError) as exc:
                  # TODO: A badly formatted date is passed to add_event
                  logging.warning(exc)
  
          dtstart = dtstart or datetime.now()
          event_form = event_form_class()
          recurrence_form = recurrence_form_class(initial={'dtstart': dtstart})
  
      return render(
          request,
          template,
          {'dtstart': dtstart, 'event_form': event_form, 'recurrence_form': recurrence_form}
      )