def METHOD_NAME(args):
    """
    Execute pcluster dcv connect command.
    :param args: pcluster cli arguments.
    """
    try:
        head_node = Cluster(args.cluster_name).head_node_instance
    except Exception as e:
        error(f"Unable to connect to the cluster.\n{e}")
    else:
        head_node_ip = head_node.public_ip or head_node.private_ip
        # Prepare ssh command to execute in the head node instance
        cmd = 'ssh {CFN_USER}@{HEAD_NODE_IP} {KEY} "{REMOTE_COMMAND} /home/{CFN_USER}"'.format(
            CFN_USER=head_node.default_user,
            HEAD_NODE_IP=head_node_ip,
            KEY="-i {0}".format(args.key_path) if args.key_path else "",
            REMOTE_COMMAND=DCV_CONNECT_SCRIPT,
        )
        try:
            url = _retry(_retrieve_dcv_session_url, func_args=[cmd, args.cluster_name, head_node_ip], attempts=4)
            url_message = f"Please use the following one-time URL in your browser within 30 seconds:\n{url}"
            if args.show_url:
                print(url_message)
                return
            try:
                if not webbrowser.open_new(url):
                    raise webbrowser.Error("Unable to open the Web browser.")
            except webbrowser.Error as e:
                print(f"{e}\n{url_message}")
        except DCVConnectionError as e:
            error(
                "Something went wrong during DCV connection.\n{0}"
                "Please check the logs in the /var/log/parallelcluster/ folder "
                "of the head node and submit an issue {1}\n".format(e, PCLUSTER_ISSUES_LINK)
            )