def AddFieldToUpdateMask(field, patch_request):
  """Adds name of field to update mask."""
  if patch_request is None:
    return None
  update_mask = patch_request.updateMask
  if update_mask:
    if update_mask.count(field) == 0:
      patch_request.updateMask = update_mask + ',' + field
  else:
    patch_request.updateMask = field
  return patch_request