def serialize(self):
    data = super(CustomCaptchaTask, self).serialize()
    data.update({'type': self.type, 'imageUrl': self.imageUrl})
    if self.form:
        forms = []
        for (name, field) in self.form.items():
            if isinstance(field, BaseField):
                forms.append(field.serialize(name))
            else:
                field = field.copy()
                field['name'] = name
                forms.append(field)
        data['forms'] = forms
    if self.assignment:
        data['assignment'] = self.assignment
    return data
def serialize(self):
    data = super(CustomCaptchaTask, self).serialize()
    data.update({'type': self.type, 'imageUrl': self.imageUrl})
    if self.form:
        forms = []
        for (name, field) in self.form.items():
            if isinstance(field, BaseField):
                forms.append(field.serialize(name))
            else:
                field = field.copy()
                field['name'] = name
                forms.append(field)
        data['forms'] = forms
    if self.assignment:
        data['assignment'] = self.assignment
    return data