Build a host prefix for a notification message based on a client id.

def _HostPrefix(client_id):
  """Build a host prefix for a notification message based on a client id."""
  if not client_id:
    return ""

  hostname = None
  if data_store.RelationalDBEnabled():
    client_snapshot = data_store.REL_DB.ReadClientSnapshot(client_id)
    if client_snapshot:
      hostname = client_snapshot.knowledge_base.fqdn
  else:
    client_fd = aff4.FACTORY.Open(client_id, mode="rw")
    hostname = client_fd.Get(client_fd.Schema.FQDN) or ""

  if hostname:
    return "%s: " % hostname
  else:
    return ""