<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_endpoint_create_and_update_params(endpoint_type, managed, params):
 """ Given an endpoint type of "shared" "server" or "personal" and option values Confirms the option values are valid for the given endpoint """

    # options only allowed for GCS endpoints
    if endpoint_type != "server":
        # catch params with two option flags
        if params["public"] is False:
            raise click.UsageError(
                "Option --private only allowed " "for Globus Connect Server endpoints"
            )
        # catch any params only usable with GCS
        for option in [
            "public",
            "myproxy_dn",
            "myproxy_server",
            "oauth_server",
            "location",
            "network_use",
            "max_concurrency",
            "preferred_concurrency",
            "max_parallelism",
            "preferred_parallelism",
        ]:
            if params[option] is not None:
                raise click.UsageError(
                    (
                        "Option --{} can only be used with Globus Connect Server "
                        "endpoints".format(option.replace("_", "-"))
                    )
                )

    # if the endpoint was not previously managed, and is not being passed
    # a subscription id, it cannot use managed endpoint only fields
    if (not managed) and not (params["subscription_id"] or params["managed"]):
        for option in [
            "network_use",
            "max_concurrency",
            "preferred_concurrency",
            "max_parallelism",
            "preferred_parallelism",
        ]:
            if params[option] is not None:
                raise click.UsageError(
                    (
                        "Option --{} can only be used with managed "
                        "endpoints".format(option.replace("_", "-"))
                    )
                )

    # because the Transfer service doesn't do network use level updates in a
    # patchy way, *both* endpoint `POST`s *and* `PUT`s must either use
    # - `network_use='custom'` with *every* other parameter specified (which
    #   is validated by the service), or
    # - a preset/absent `network_use` with *no* other parameter specified
    #   (which is *not* validated by the service; in this case, Transfer will
    #   accept but ignore the others parameters if given, leading to user
    #   confusion if we don't do this validation check)
    custom_network_use_params = (
        "max_concurrency",
        "preferred_concurrency",
        "max_parallelism",
        "preferred_parallelism",
    )
    if params["network_use"] != "custom":
        for option in custom_network_use_params:
            if params[option] is not None:
                raise click.UsageError(
                    "The {} options require you use --network-use=custom.".format(
                        "/".join(
                            "--" + option.replace("_", "-")
                            for option in custom_network_use_params
                        )
                    )
                )

    # make sure --(no-)managed and --subscription-id are mutually exclusive
    # if --managed given pass DEFAULT as the subscription_id
    # if --no-managed given, pass None
    managed_flag = params.get("managed")
    if managed_flag is not None:
        params.pop("managed")
        if managed_flag:
            params["subscription_id"] = params.get("subscription_id") or "DEFAULT"
        else:
            if params.get("subscription_id"):
                raise click.UsageError(
                    "Cannot specify --subscription-id and "
                    "use the --no-managed option."
                )
            params["subscription_id"] = EXPLICIT_NULL

    # make sure --no-default-directory are mutually exclusive
    # if --no-managed given, pass an EXPLICIT_NULL as the default directory
    if params.get("no_default_directory"):

        if params.get("default_directory"):
            raise click.UsageError(
                "--no-default-directory and --default-directory are mutually "
                "exclusive."
            )
        else:
            params["default_directory"] = EXPLICIT_NULL
            params.pop("no_default_directory")