import uuid


def create_keyword_plan(client, customer_id):
    """Adds a keyword plan to the given customer account.

    Args:
        client: An initialized instance of GoogleAdsClient
        customer_id: A str of the customer_id to use in requests.

    Returns:
        A str of the resource_name for the newly created keyword plan.

    Raises:
        GoogleAdsException: If an error is returned from the API.
    """
    operation = client.get_type('KeywordPlanOperation', version='v2')
    keyword_plan = operation.create

    keyword_plan.name.value = ('Keyword plan for traffic estimate {}'.format(
        uuid.uuid4()))

    forecast_interval = client.get_type('KeywordPlanForecastIntervalEnum',
                                        version='v2').NEXT_QUARTER
    keyword_plan.forecast_period.date_interval = forecast_interval

    keyword_plan_service = client.get_service('KeywordPlanService',
                                              version='v2')
    response = keyword_plan_service.mutate_keyword_plans(customer_id,
                                                         [operation])
    resource_name = response.results[0].resource_name

    print('Created keyword plan with resource name: {}'.format(resource_name))

    return resource_name