We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[feature] Tool: is_msvc helper
Our friend and great contributor SpaceIm is using a new detection which I believe could be part of the mainstream:

```python
@property
def _is_msvc(self):
    return str(self.settings.compiler) in ["Visual Studio", "msvc"]
```

This property can be largely re-used, when checking on `validate()` or any other condition.


- [ ] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md).


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conan/tools/microsoft/__init__.py`
Content:
```
1 from conan.tools.microsoft.toolchain import MSBuildToolchain
2 from conan.tools.microsoft.msbuild import MSBuild
3 from conan.tools.microsoft.msbuilddeps import MSBuildDeps
4 from conan.tools.microsoft.visual import msvc_runtime_flag, VCVars
5 from conan.tools.microsoft.subsystems import subsystem_path
6
```

Path: `conan/tools/microsoft/visual.py`
Content:
```
1 import os
2 import textwrap
3 
4 from conans.client.tools import vs_installation_path
5 from conans.errors import ConanException
6 
7 CONAN_VCVARS_FILE = "conanvcvars.bat"
8 
9 
10 def msvc_version_to_vs_ide_version(version):
11     _visuals = {'190': '14',
12                 '191': '15',
13                 '192': '16',
14                 '193': '17'}
15     return _visuals[str(version)]
16 
17 
18 class VCVars:
19     def __init__(self, conanfile):
20         self._conanfile = conanfile
21 
22     def generate(self, scope="build"):
23         """
24         write a conanvcvars.bat file with the good args from settings
25         """
26         conanfile = self._conanfile
27         os_ = conanfile.settings.get_safe("os")
28         if os_ != "Windows":
29             return
30 
31         compiler = conanfile.settings.get_safe("compiler")
32         if compiler != "Visual Studio" and compiler != "msvc":
33             return
34 
35         vs_version = vs_ide_version(conanfile)
36         vcvarsarch = vcvars_arch(conanfile)
37         vcvars_ver = _vcvars_vers(conanfile, compiler, vs_version)
38 
39         vs_install_path = conanfile.conf["tools.microsoft.msbuild:installation_path"]
40         # The vs_install_path is like
41         # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
42         # C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
43         # C:\Program Files (x86)\Microsoft Visual Studio 14.0
44         vcvars = vcvars_command(vs_version, architecture=vcvarsarch, platform_type=None,
45                                 winsdk_version=None, vcvars_ver=vcvars_ver,
46                                 vs_install_path=vs_install_path)
47 
48         content = textwrap.dedent("""\
49             @echo off
50             {}
51             """.format(vcvars))
52         from conan.tools.env.environment import create_env_script
53         create_env_script(conanfile, content, CONAN_VCVARS_FILE, scope)
54 
55 
56 def vs_ide_version(conanfile):
57     compiler = conanfile.settings.get_safe("compiler")
58     compiler_version = (conanfile.settings.get_safe("compiler.base.version") or
59                         conanfile.settings.get_safe("compiler.version"))
60     if compiler == "msvc":
61         toolset_override = conanfile.conf["tools.microsoft.msbuild:vs_version"]
62         if toolset_override:
63             visual_version = toolset_override
64         else:
65             visual_version = msvc_version_to_vs_ide_version(compiler_version)
66     else:
67         visual_version = compiler_version
68     return visual_version
69 
70 
71 def msvc_runtime_flag(conanfile):
72     settings = conanfile.settings
73     compiler = settings.get_safe("compiler")
74     runtime = settings.get_safe("compiler.runtime")
75     if compiler == "Visual Studio":
76         return runtime
77     if compiler == "msvc" or compiler == "intel-cc":
78         runtime_type = settings.get_safe("compiler.runtime_type")
79         runtime = "MT" if runtime == "static" else "MD"
80         if runtime_type == "Debug":
81             runtime = "{}d".format(runtime)
82         return runtime
83 
84 
85 def vcvars_command(version, architecture=None, platform_type=None, winsdk_version=None,
86                    vcvars_ver=None, start_dir_cd=True, vs_install_path=None):
87     """ conan-agnostic construction of vcvars command
88     https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
89     """
90     # TODO: This comes from conans/client/tools/win.py vcvars_command()
91     cmd = []
92     if start_dir_cd:
93         cmd.append('set "VSCMD_START_DIR=%CD%" &&')
94 
95     # The "call" is useful in case it is called from another .bat script
96     cmd.append('call "%s" ' % _vcvars_path(version, vs_install_path))
97     if architecture:
98         cmd.append(architecture)
99     if platform_type:
100         cmd.append(platform_type)
101     if winsdk_version:
102         cmd.append(winsdk_version)
103     if vcvars_ver:
104         cmd.append("-vcvars_ver=%s" % vcvars_ver)
105     return " ".join(cmd)
106 
107 
108 def _vcvars_path(version, vs_install_path):
109     # TODO: This comes from conans/client/tools/win.py vcvars_command()
110     vs_path = vs_install_path or vs_installation_path(version)
111     if not vs_path or not os.path.isdir(vs_path):
112         raise ConanException("VS non-existing installation: Visual Studio %s" % version)
113 
114     if int(version) > 14:
115         vcpath = os.path.join(vs_path, "VC/Auxiliary/Build/vcvarsall.bat")
116     else:
117         vcpath = os.path.join(vs_path, "VC/vcvarsall.bat")
118     return vcpath
119 
120 
121 def vcvars_arch(conanfile):
122     """
123     computes the vcvars command line architecture based on conanfile settings (host) and
124     settings_build
125     :param conanfile:
126     :return:
127     """
128     # TODO: This comes from conans/client/tools/win.py vcvars_command()
129     settings_host = conanfile.settings
130     try:
131         settings_build = conanfile.settings_build
132     except AttributeError:
133         settings_build = settings_host
134 
135     arch_host = str(settings_host.arch)
136     arch_build = str(settings_build.arch)
137 
138     arch = None
139     if arch_build == 'x86_64':
140         arch = {'x86': "amd64_x86",
141                 'x86_64': 'amd64',
142                 'armv7': 'amd64_arm',
143                 'armv8': 'amd64_arm64'}.get(arch_host)
144     elif arch_build == 'x86':
145         arch = {'x86': 'x86',
146                 'x86_64': 'x86_amd64',
147                 'armv7': 'x86_arm',
148                 'armv8': 'x86_arm64'}.get(arch_host)
149 
150     if not arch:
151         raise ConanException('vcvars unsupported architectures %s-%s' % (arch_build, arch_host))
152 
153     return arch
154 
155 
156 def _vcvars_vers(conanfile, compiler, vs_version):
157     if int(vs_version) <= 14:
158         return None
159 
160     vcvars_ver = None
161     if compiler == "Visual Studio":
162         toolset = conanfile.settings.get_safe("compiler.toolset")
163         if toolset is not None:
164             vcvars_ver = {"v140": "14.0",
165                           "v141": "14.1",
166                           "v142": "14.2",
167                           "v143": "14.3"}.get(toolset)
168     else:
169         assert compiler == "msvc"
170         # Code similar to CMakeToolchain toolset one
171         compiler_version = str(conanfile.settings.compiler.version)
172         # The equivalent of compiler 192 is toolset 14.2
173         vcvars_ver = "14.{}".format(compiler_version[-1])
174     return vcvars_ver
175
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conan/tools/microsoft/__init__.py b/conan/tools/microsoft/__init__.py
--- a/conan/tools/microsoft/__init__.py
+++ b/conan/tools/microsoft/__init__.py
@@ -1,5 +1,5 @@
 from conan.tools.microsoft.toolchain import MSBuildToolchain
 from conan.tools.microsoft.msbuild import MSBuild
 from conan.tools.microsoft.msbuilddeps import MSBuildDeps
-from conan.tools.microsoft.visual import msvc_runtime_flag, VCVars
+from conan.tools.microsoft.visual import msvc_runtime_flag, VCVars, is_msvc
 from conan.tools.microsoft.subsystems import subsystem_path
diff --git a/conan/tools/microsoft/visual.py b/conan/tools/microsoft/visual.py
--- a/conan/tools/microsoft/visual.py
+++ b/conan/tools/microsoft/visual.py
@@ -172,3 +172,12 @@
         # The equivalent of compiler 192 is toolset 14.2
         vcvars_ver = "14.{}".format(compiler_version[-1])
     return vcvars_ver
+
+
+def is_msvc(conanfile):
+    """ Validate if current compiler in setttings is 'Visual Studio' or 'msvc'
+    :param conanfile: ConanFile instance
+    :return: True, if the host compiler is related to Visual Studio, otherwise, False.
+    """
+    settings = conanfile.settings
+    return settings.get_safe("compiler") in ["Visual Studio", "msvc"]

{"golden_diff": "diff --git a/conan/tools/microsoft/__init__.py b/conan/tools/microsoft/__init__.py\n--- a/conan/tools/microsoft/__init__.py\n+++ b/conan/tools/microsoft/__init__.py\n@@ -1,5 +1,5 @@\n from conan.tools.microsoft.toolchain import MSBuildToolchain\n from conan.tools.microsoft.msbuild import MSBuild\n from conan.tools.microsoft.msbuilddeps import MSBuildDeps\n-from conan.tools.microsoft.visual import msvc_runtime_flag, VCVars\n+from conan.tools.microsoft.visual import msvc_runtime_flag, VCVars, is_msvc\n from conan.tools.microsoft.subsystems import subsystem_path\ndiff --git a/conan/tools/microsoft/visual.py b/conan/tools/microsoft/visual.py\n--- a/conan/tools/microsoft/visual.py\n+++ b/conan/tools/microsoft/visual.py\n@@ -172,3 +172,12 @@\n         # The equivalent of compiler 192 is toolset 14.2\n         vcvars_ver = \"14.{}\".format(compiler_version[-1])\n     return vcvars_ver\n+\n+\n+def is_msvc(conanfile):\n+    \"\"\" Validate if current compiler in setttings is 'Visual Studio' or 'msvc'\n+    :param conanfile: ConanFile instance\n+    :return: True, if the host compiler is related to Visual Studio, otherwise, False.\n+    \"\"\"\n+    settings = conanfile.settings\n+    return settings.get_safe(\"compiler\") in [\"Visual Studio\", \"msvc\"]\n", "issue": "[feature] Tool: is_msvc helper\nOur friend and great contributor SpaceIm is using a new detection which I believe could be part of the mainstream:\r\n\r\n```python\r\n@property\r\ndef _is_msvc(self):\r\n    return str(self.settings.compiler) in [\"Visual Studio\", \"msvc\"]\r\n```\r\n\r\nThis property can be largely re-used, when checking on `validate()` or any other condition.\r\n\r\n\r\n- [ ] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md).\r\n\n", "before_files": [{"content": "from conan.tools.microsoft.toolchain import MSBuildToolchain\nfrom conan.tools.microsoft.msbuild import MSBuild\nfrom conan.tools.microsoft.msbuilddeps import MSBuildDeps\nfrom conan.tools.microsoft.visual import msvc_runtime_flag, VCVars\nfrom conan.tools.microsoft.subsystems import subsystem_path\n", "path": "conan/tools/microsoft/__init__.py"}, {"content": "import os\nimport textwrap\n\nfrom conans.client.tools import vs_installation_path\nfrom conans.errors import ConanException\n\nCONAN_VCVARS_FILE = \"conanvcvars.bat\"\n\n\ndef msvc_version_to_vs_ide_version(version):\n    _visuals = {'190': '14',\n                '191': '15',\n                '192': '16',\n                '193': '17'}\n    return _visuals[str(version)]\n\n\nclass VCVars:\n    def __init__(self, conanfile):\n        self._conanfile = conanfile\n\n    def generate(self, scope=\"build\"):\n        \"\"\"\n        write a conanvcvars.bat file with the good args from settings\n        \"\"\"\n        conanfile = self._conanfile\n        os_ = conanfile.settings.get_safe(\"os\")\n        if os_ != \"Windows\":\n            return\n\n        compiler = conanfile.settings.get_safe(\"compiler\")\n        if compiler != \"Visual Studio\" and compiler != \"msvc\":\n            return\n\n        vs_version = vs_ide_version(conanfile)\n        vcvarsarch = vcvars_arch(conanfile)\n        vcvars_ver = _vcvars_vers(conanfile, compiler, vs_version)\n\n        vs_install_path = conanfile.conf[\"tools.microsoft.msbuild:installation_path\"]\n        # The vs_install_path is like\n        # C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\n        # C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\n        # C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\n        vcvars = vcvars_command(vs_version, architecture=vcvarsarch, platform_type=None,\n                                winsdk_version=None, vcvars_ver=vcvars_ver,\n                                vs_install_path=vs_install_path)\n\n        content = textwrap.dedent(\"\"\"\\\n            @echo off\n            {}\n            \"\"\".format(vcvars))\n        from conan.tools.env.environment import create_env_script\n        create_env_script(conanfile, content, CONAN_VCVARS_FILE, scope)\n\n\ndef vs_ide_version(conanfile):\n    compiler = conanfile.settings.get_safe(\"compiler\")\n    compiler_version = (conanfile.settings.get_safe(\"compiler.base.version\") or\n                        conanfile.settings.get_safe(\"compiler.version\"))\n    if compiler == \"msvc\":\n        toolset_override = conanfile.conf[\"tools.microsoft.msbuild:vs_version\"]\n        if toolset_override:\n            visual_version = toolset_override\n        else:\n            visual_version = msvc_version_to_vs_ide_version(compiler_version)\n    else:\n        visual_version = compiler_version\n    return visual_version\n\n\ndef msvc_runtime_flag(conanfile):\n    settings = conanfile.settings\n    compiler = settings.get_safe(\"compiler\")\n    runtime = settings.get_safe(\"compiler.runtime\")\n    if compiler == \"Visual Studio\":\n        return runtime\n    if compiler == \"msvc\" or compiler == \"intel-cc\":\n        runtime_type = settings.get_safe(\"compiler.runtime_type\")\n        runtime = \"MT\" if runtime == \"static\" else \"MD\"\n        if runtime_type == \"Debug\":\n            runtime = \"{}d\".format(runtime)\n        return runtime\n\n\ndef vcvars_command(version, architecture=None, platform_type=None, winsdk_version=None,\n                   vcvars_ver=None, start_dir_cd=True, vs_install_path=None):\n    \"\"\" conan-agnostic construction of vcvars command\n    https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line\n    \"\"\"\n    # TODO: This comes from conans/client/tools/win.py vcvars_command()\n    cmd = []\n    if start_dir_cd:\n        cmd.append('set \"VSCMD_START_DIR=%CD%\" &&')\n\n    # The \"call\" is useful in case it is called from another .bat script\n    cmd.append('call \"%s\" ' % _vcvars_path(version, vs_install_path))\n    if architecture:\n        cmd.append(architecture)\n    if platform_type:\n        cmd.append(platform_type)\n    if winsdk_version:\n        cmd.append(winsdk_version)\n    if vcvars_ver:\n        cmd.append(\"-vcvars_ver=%s\" % vcvars_ver)\n    return \" \".join(cmd)\n\n\ndef _vcvars_path(version, vs_install_path):\n    # TODO: This comes from conans/client/tools/win.py vcvars_command()\n    vs_path = vs_install_path or vs_installation_path(version)\n    if not vs_path or not os.path.isdir(vs_path):\n        raise ConanException(\"VS non-existing installation: Visual Studio %s\" % version)\n\n    if int(version) > 14:\n        vcpath = os.path.join(vs_path, \"VC/Auxiliary/Build/vcvarsall.bat\")\n    else:\n        vcpath = os.path.join(vs_path, \"VC/vcvarsall.bat\")\n    return vcpath\n\n\ndef vcvars_arch(conanfile):\n    \"\"\"\n    computes the vcvars command line architecture based on conanfile settings (host) and\n    settings_build\n    :param conanfile:\n    :return:\n    \"\"\"\n    # TODO: This comes from conans/client/tools/win.py vcvars_command()\n    settings_host = conanfile.settings\n    try:\n        settings_build = conanfile.settings_build\n    except AttributeError:\n        settings_build = settings_host\n\n    arch_host = str(settings_host.arch)\n    arch_build = str(settings_build.arch)\n\n    arch = None\n    if arch_build == 'x86_64':\n        arch = {'x86': \"amd64_x86\",\n                'x86_64': 'amd64',\n                'armv7': 'amd64_arm',\n                'armv8': 'amd64_arm64'}.get(arch_host)\n    elif arch_build == 'x86':\n        arch = {'x86': 'x86',\n                'x86_64': 'x86_amd64',\n                'armv7': 'x86_arm',\n                'armv8': 'x86_arm64'}.get(arch_host)\n\n    if not arch:\n        raise ConanException('vcvars unsupported architectures %s-%s' % (arch_build, arch_host))\n\n    return arch\n\n\ndef _vcvars_vers(conanfile, compiler, vs_version):\n    if int(vs_version) <= 14:\n        return None\n\n    vcvars_ver = None\n    if compiler == \"Visual Studio\":\n        toolset = conanfile.settings.get_safe(\"compiler.toolset\")\n        if toolset is not None:\n            vcvars_ver = {\"v140\": \"14.0\",\n                          \"v141\": \"14.1\",\n                          \"v142\": \"14.2\",\n                          \"v143\": \"14.3\"}.get(toolset)\n    else:\n        assert compiler == \"msvc\"\n        # Code similar to CMakeToolchain toolset one\n        compiler_version = str(conanfile.settings.compiler.version)\n        # The equivalent of compiler 192 is toolset 14.2\n        vcvars_ver = \"14.{}\".format(compiler_version[-1])\n    return vcvars_ver\n", "path": "conan/tools/microsoft/visual.py"}], "after_files": [{"content": "from conan.tools.microsoft.toolchain import MSBuildToolchain\nfrom conan.tools.microsoft.msbuild import MSBuild\nfrom conan.tools.microsoft.msbuilddeps import MSBuildDeps\nfrom conan.tools.microsoft.visual import msvc_runtime_flag, VCVars, is_msvc\nfrom conan.tools.microsoft.subsystems import subsystem_path\n", "path": "conan/tools/microsoft/__init__.py"}, {"content": "import os\nimport textwrap\n\nfrom conans.client.tools import vs_installation_path\nfrom conans.errors import ConanException\n\nCONAN_VCVARS_FILE = \"conanvcvars.bat\"\n\n\ndef msvc_version_to_vs_ide_version(version):\n    _visuals = {'190': '14',\n                '191': '15',\n                '192': '16',\n                '193': '17'}\n    return _visuals[str(version)]\n\n\nclass VCVars:\n    def __init__(self, conanfile):\n        self._conanfile = conanfile\n\n    def generate(self, scope=\"build\"):\n        \"\"\"\n        write a conanvcvars.bat file with the good args from settings\n        \"\"\"\n        conanfile = self._conanfile\n        os_ = conanfile.settings.get_safe(\"os\")\n        if os_ != \"Windows\":\n            return\n\n        compiler = conanfile.settings.get_safe(\"compiler\")\n        if compiler != \"Visual Studio\" and compiler != \"msvc\":\n            return\n\n        vs_version = vs_ide_version(conanfile)\n        vcvarsarch = vcvars_arch(conanfile)\n        vcvars_ver = _vcvars_vers(conanfile, compiler, vs_version)\n\n        vs_install_path = conanfile.conf[\"tools.microsoft.msbuild:installation_path\"]\n        # The vs_install_path is like\n        # C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\n        # C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\n        # C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\n        vcvars = vcvars_command(vs_version, architecture=vcvarsarch, platform_type=None,\n                                winsdk_version=None, vcvars_ver=vcvars_ver,\n                                vs_install_path=vs_install_path)\n\n        content = textwrap.dedent(\"\"\"\\\n            @echo off\n            {}\n            \"\"\".format(vcvars))\n        from conan.tools.env.environment import create_env_script\n        create_env_script(conanfile, content, CONAN_VCVARS_FILE, scope)\n\n\ndef vs_ide_version(conanfile):\n    compiler = conanfile.settings.get_safe(\"compiler\")\n    compiler_version = (conanfile.settings.get_safe(\"compiler.base.version\") or\n                        conanfile.settings.get_safe(\"compiler.version\"))\n    if compiler == \"msvc\":\n        toolset_override = conanfile.conf[\"tools.microsoft.msbuild:vs_version\"]\n        if toolset_override:\n            visual_version = toolset_override\n        else:\n            visual_version = msvc_version_to_vs_ide_version(compiler_version)\n    else:\n        visual_version = compiler_version\n    return visual_version\n\n\ndef msvc_runtime_flag(conanfile):\n    settings = conanfile.settings\n    compiler = settings.get_safe(\"compiler\")\n    runtime = settings.get_safe(\"compiler.runtime\")\n    if compiler == \"Visual Studio\":\n        return runtime\n    if compiler == \"msvc\" or compiler == \"intel-cc\":\n        runtime_type = settings.get_safe(\"compiler.runtime_type\")\n        runtime = \"MT\" if runtime == \"static\" else \"MD\"\n        if runtime_type == \"Debug\":\n            runtime = \"{}d\".format(runtime)\n        return runtime\n\n\ndef vcvars_command(version, architecture=None, platform_type=None, winsdk_version=None,\n                   vcvars_ver=None, start_dir_cd=True, vs_install_path=None):\n    \"\"\" conan-agnostic construction of vcvars command\n    https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line\n    \"\"\"\n    # TODO: This comes from conans/client/tools/win.py vcvars_command()\n    cmd = []\n    if start_dir_cd:\n        cmd.append('set \"VSCMD_START_DIR=%CD%\" &&')\n\n    # The \"call\" is useful in case it is called from another .bat script\n    cmd.append('call \"%s\" ' % _vcvars_path(version, vs_install_path))\n    if architecture:\n        cmd.append(architecture)\n    if platform_type:\n        cmd.append(platform_type)\n    if winsdk_version:\n        cmd.append(winsdk_version)\n    if vcvars_ver:\n        cmd.append(\"-vcvars_ver=%s\" % vcvars_ver)\n    return \" \".join(cmd)\n\n\ndef _vcvars_path(version, vs_install_path):\n    # TODO: This comes from conans/client/tools/win.py vcvars_command()\n    vs_path = vs_install_path or vs_installation_path(version)\n    if not vs_path or not os.path.isdir(vs_path):\n        raise ConanException(\"VS non-existing installation: Visual Studio %s\" % version)\n\n    if int(version) > 14:\n        vcpath = os.path.join(vs_path, \"VC/Auxiliary/Build/vcvarsall.bat\")\n    else:\n        vcpath = os.path.join(vs_path, \"VC/vcvarsall.bat\")\n    return vcpath\n\n\ndef vcvars_arch(conanfile):\n    \"\"\"\n    computes the vcvars command line architecture based on conanfile settings (host) and\n    settings_build\n    :param conanfile:\n    :return:\n    \"\"\"\n    # TODO: This comes from conans/client/tools/win.py vcvars_command()\n    settings_host = conanfile.settings\n    try:\n        settings_build = conanfile.settings_build\n    except AttributeError:\n        settings_build = settings_host\n\n    arch_host = str(settings_host.arch)\n    arch_build = str(settings_build.arch)\n\n    arch = None\n    if arch_build == 'x86_64':\n        arch = {'x86': \"amd64_x86\",\n                'x86_64': 'amd64',\n                'armv7': 'amd64_arm',\n                'armv8': 'amd64_arm64'}.get(arch_host)\n    elif arch_build == 'x86':\n        arch = {'x86': 'x86',\n                'x86_64': 'x86_amd64',\n                'armv7': 'x86_arm',\n                'armv8': 'x86_arm64'}.get(arch_host)\n\n    if not arch:\n        raise ConanException('vcvars unsupported architectures %s-%s' % (arch_build, arch_host))\n\n    return arch\n\n\ndef _vcvars_vers(conanfile, compiler, vs_version):\n    if int(vs_version) <= 14:\n        return None\n\n    vcvars_ver = None\n    if compiler == \"Visual Studio\":\n        toolset = conanfile.settings.get_safe(\"compiler.toolset\")\n        if toolset is not None:\n            vcvars_ver = {\"v140\": \"14.0\",\n                          \"v141\": \"14.1\",\n                          \"v142\": \"14.2\",\n                          \"v143\": \"14.3\"}.get(toolset)\n    else:\n        assert compiler == \"msvc\"\n        # Code similar to CMakeToolchain toolset one\n        compiler_version = str(conanfile.settings.compiler.version)\n        # The equivalent of compiler 192 is toolset 14.2\n        vcvars_ver = \"14.{}\".format(compiler_version[-1])\n    return vcvars_ver\n\n\ndef is_msvc(conanfile):\n    \"\"\" Validate if current compiler in setttings is 'Visual Studio' or 'msvc'\n    :param conanfile: ConanFile instance\n    :return: True, if the host compiler is related to Visual Studio, otherwise, False.\n    \"\"\"\n    settings = conanfile.settings\n    return settings.get_safe(\"compiler\") in [\"Visual Studio\", \"msvc\"]\n", "path": "conan/tools/microsoft/visual.py"}]}