code: def normalize_name(name):
      '''
      Strips the architecture from the specified package name, if necessary.
      Circumstances where this would be done include:
  
      * If the arch is 32 bit and the package name ends in a 32-bit arch.
      * If the arch matches the OS arch, or is ``noarch``.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' pkg.normalize_name zsh.x86_64
      '''
      try:
          arch = name.rsplit('.', 1)[-1]
          if arch not in salt.utils.pkg.rpm.ARCHES + ('noarch',):
              return name
      except ValueError:
          return name
      if arch in (__grains__['osarch'], 'noarch') \
              or salt.utils.pkg.rpm.check_32(arch, osarch=__grains__['osarch']):
          return name[:-(len(arch) + 1)]
      return namf normalize_name(name):
      '''
      Strips the architecture from the specified package name, if necessary.
      Circumstances where this would be done include:
  
      * If the arch is 32 bit and the package name ends in a 32-bit arch.
      * If the arch matches the OS arch, or is ``noarch``.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' pkg.normalize_name zsh.x86_64
      '''
      try:
          arch = name.rsplit('.', 1)[-1]
          if arch not in salt.utils.pkg.rpm.ARCHES + ('noarch',):
              return name
      except ValueError:
          return name
      if arch in (__grains__['osarch'], 'noarch') \
              or salt.utils.pkg.rpm.check_32(arch, osarch=__grains__['osarch']):
          return name[:-(len(arch) + 1)]
      return name
docs: Strips the architecture from the specified package name, if necessary.
      Circumstances where this would be done include:
  
      * If the arch is 32 bit and the package name ends in a 32-bit arch.
      * If the arch matches the OS arch, or is ``noarch``.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' pkg.normalize_name zsh.x86_64