<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def dispatch(self, request, *args, **kwargs):
        ''' If a list of customers or groups was passed, then parse it '''
        ids = request.GET.get('customers')
        groups = request.GET.get('customergroup')
        self.customers = None

        if ids or groups:
            # Initial filter applies to no one but allows appending by logical or
            filters = Q(id__isnull=True)

            if ids:
                filters = filters | Q(id__in=[int(x) for x in ids.split(',')])
            if groups:
                filters = filters | Q(groups__id__in=[int(x) for x in groups.split(',')])

            try:
                self.customers = Customer.objects.filter(filters)
            except ValueError:
                return HttpResponseBadRequest(_('Invalid customer ids passed'))

        return super(SendEmailView, self).dispatch(request, *args, **kwargs)