'Break down CSV file into fields'

def parse_contacts(self, contacts):

    for row in contacts:
        try:
            type = row['type']
        except Exception:
            pass
        try:
            name = row['name']
        except Exception:
            try:
                firstname = row['firstname']
                surname = row['surname']
                name = ((firstname + '    ') + surname)
            except Exception:
                continue
        contact_type = ContactType.objects.filter(name=type)
        if contact_type:
            contact_type = contact_type[0]
        contact_exists = Contact.objects.filter(name=name, contact_type__name=type, trash=False)
        if (not contact_exists):
            contact = Contact()
            contact.name = name
            contact.contact_type = contact_type
            contact.auto_notify = False
            contact.save()
            fields = contact_type.fields.filter(trash=False)
            for field in fields:
                if (field.name in row):
                    x = row[field.name]
                    if (field.field_type == 'email'):
                        x = self.verify_email(x)
                    if (field.field_type == 'url'):
                        x = self.verify_url(x)
                    if x:
                        contact_value = ContactValue()
                        contact_value.field = field
                        contact_value.contact = contact
                        contact_value.value = x
                        contact_value.save()
