import uuid


def CreateBudget(client):
  """Adds a new budget.

  Args:
    client: an AdWordsClient instance.
  Returns:
    A budget ID.
  """
  budget_service = client.GetService('BudgetService', version='v201809')

  budget = {
      'name': 'Interplanetary budget #%s' % uuid.uuid4(),
      'amount': {
          'microAmount': '50000000'
      },
      'deliveryMethod': 'STANDARD',
      # Non-shared budgets are required for Smart Shopping campaigns.
      'isExplicitlyShared': False
  }

  budget_operations = [{
      'operator': 'ADD',
      'operand': budget
  }]

  # Add the budget.
  budget_id = budget_service.mutate(budget_operations)['value'][0][
      'budgetId']

  return budget_id