def AppIdWithDefaultPartition(app_id, default_partition):
  """Add a partition to an application id if necessary."""
  if not default_partition:
    return app_id



  if '~' in app_id:
    return app_id

  return default_partition + '~' + app_id