def METHOD_NAME(cmd, client,
                          name, tenant_id, principal_id, role_definition_id,
                          plan_name=None, plan_product=None, plan_publisher=None, plan_version=None, description=None,
                          definition_id=None):
    from azure.mgmt.managedservices.models import RegistrationDefinitionProperties, Plan, \
        Authorization
    if not definition_id:
        definition_id = str(uuid.uuid4())
    subscription = _get_subscription_id_from_cmd(cmd)
    scope = _get_scope(subscription)
    if plan_name and plan_product and plan_publisher and plan_version:
        plan = Plan(plan_name, plan_publisher, plan_product, plan_version)
    else:
        plan = None
    authorization = Authorization(
        principal_id=principal_id,
        role_definition_id=role_definition_id)
    authorizations = [authorization]
    properties = RegistrationDefinitionProperties(
        description=description,
        authorizations=authorizations,
        registration_definition_name=name,
        managed_by_tenant_id=tenant_id,
        Plan=plan,
    )
    return client.create_or_update(
        registration_definition_id=definition_id,
        scope=scope,
        properties=properties)