def init_plan_v1(yml_input_plan):
    if not yml_input_plan.get('name'):
        raise exception.BadRequest(reason="Name field is missing.")
    try:
        pp = plan.Plan(**yml_input_plan)
    except __HOLE__ as ve:
        raise exception.BadRequest(reason=six.text_type(ve))
    try:
        name_regex = re.compile(r'^([a-zA-Z0-9-_]{1,100})$')
        assert name_regex.match(pp.name), 'Plan name is invalid.'
    except AssertionError as ae:
        raise exception.BadRequest(reason=six.text_type(ae))
    return pp
dataset/ETHPy150Open openstack/solum/solum/api/controllers/v1/plan.py/init_plan_v1