def contact_type_to_dict(obj, contact_type):
    """
    Build the contact details for a contact type in to a dict
    """

    assert contact_type in ["electoral_services", "registration"]
    data = {}
    for key in ["phone_numbers", "email", "address", "postcode", "website"]:
        data[key] = getattr(obj, "{}_{}".format(contact_type, key))
    if not any(data.values()):
        data = None
    return data