def import_domain(user, row, formopts):
    if not user.has_perm("admin.add_domain"):
        raise PermDeniedException(_("You are not allowed to import domains"))
    core_signals.can_create_object.send(
        sender="import", context=user, object_type="domains")
    dom = Domain()
    dom.from_csv(user, row)
Specific code for domains import
dataset/ETHPy150Open tonioo/modoboa/modoboa/admin/lib.py/import_domain