def has_pythonX_package(pkg_name, name_by_version, version):
    """Given the package name, check if python<version>-<pkg_name>
    or <pkg_name>-python<version> exists in name_by_version.

    Return: (bool) True if such package name exists, False otherwise
    """
    return 'python{}-{}'.format(version, pkg_name) in name_by_version[version
        ] or '{}-python{}'.format(pkg_name, version) in name_by_version[version
        ]
