def function(asset, hazards):
  loss = asset.get('value')
  if hazards is not None:
    if hazards.get('hazard1') is not None:
      loss = loss * hazards.get('hazard1')
    if hazards.get('hazard2') is not None:
      loss = loss * hazards.get('hazard2')
  return loss
