def render(args):
    """
    Helper to parse REST Api requests

    :param args:
    :return:
    """
    query = database.session_query(Domain)
    filt = args.pop("filter")
    certificate_id = args.pop("certificate_id", None)

    if filt:
        terms = filt.split(";")
        query = database.filter(query, Domain, terms)

    if certificate_id:
        query = query.join(Certificate, Domain.certificates)
        query = query.filter(Certificate.id == certificate_id)

    return database.sort_and_page(query, Domain, args)

    Helper to parse REST Api requests

    :param args:
    :return:
    
lemur/domains/service.py