def get_domains(user, domfilter=None, searchquery=None, **extrafilters):
    domains = Domain.objects.get_for_admin(user)
    if domfilter:
        domains = domains.filter(type=domfilter)
    if searchquery is not None:
        q = Q(name__contains=searchquery)
        q |= Q(domainalias__name__contains=searchquery)
        domains = domains.filter(q).distinct()
    qset_filters = events.raiseDictEvent(
        "ExtraDomainQsetFilters", domfilter, extrafilters
    )
    if qset_filters:
        domains = domains.filter(**qset_filters)
    return domains
Initialize configurations.
dataset/ETHPy150Open tonioo/modoboa/modoboa/admin/lib.py/get_domains--crossover with--dataset/ETHPy150Open codalab/codalab-cli/codalab/lib/codalab_manager.py/CodaLabManager.init_config