def METHOD_NAME(self):
    hname = getattr(settings, "MONITORING_HOST_NAME", None) or "localhost"
    sname = getattr(settings, "MONITORING_SERVICE_NAME", None) or "geonode"
    try:
        host = Host.objects.get(name=hname)
    except Host.DoesNotExist:
        host = None
    if host:
        try:
            service = Service.objects.get(host=host, name=sname)
        except Service.DoesNotExist:
            service = None
        return service