async def METHOD_NAME(
    conn: triopg._triopg.TrioConnectionProxy,
    organization_id: OrganizationID,
    author: DeviceID,
    realm_id: RealmID,
) -> RealmStatus:
    ret = await conn.fetchrow(
        *_q_get_realm_status(
            organization_id=organization_id.str, realm_id=realm_id, user_id=author.user_id.str
        )
    )
    if not ret:
        raise RealmNotFoundError(f"Realm `{realm_id.hex}` doesn't exist")
    if not ret["has_access"]:
        raise RealmAccessError()
    return RealmStatus(
        maintenance_type=MaintenanceType.from_str(ret["maintenance_type"])
        if ret["maintenance_type"]
        else None,
        maintenance_started_on=ret["maintenance_started_on"],
        maintenance_started_by=DeviceID(ret["maintenance_started_by"])
        if ret["maintenance_started_by"]
        else None,
        encryption_revision=ret["encryption_revision"],
    )