def normalize_name(name):
    """
    Strips the architecture from the specified package name, if necessary.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.normalize_name zsh:amd64
    """
    try:
        pkgname, pkgarch = name.rsplit(PKG_ARCH_SEPARATOR, 1)
    except ValueError:
        pkgname = name
        pkgarch = __grains__["osarch"]

    return pkgname if pkgarch in (__grains__["osarch"], "all", "any") else name