def ResourcePath(package_name, filepath):
  """Computes a path to the specified package resource.

  Args:
    package_name: A name of the package where the resource is located.
    filepath: A path to the resource relative to the package location.

  Returns:
    A path to the resource or `None` if the resource cannot be found.
  """
  # If we are running a pyinstaller-built binary we rely on the sys.prefix
  # code below and avoid running this which will generate confusing error
  # messages.
  if not getattr(sys, "frozen", None):
    target = _GetPkgResources(package_name, filepath)
    if target and os.access(target, os.R_OK):
      return target

  # Installing from wheel places data_files relative to sys.prefix and not
  # site-packages. If we can not find in site-packages, check sys.prefix
  # instead.
  # https://python-packaging-user-guide.readthedocs.io/en/latest/distributing/#data-files
  target = os.path.join(sys.prefix, filepath)
  if target and os.access(target, os.R_OK):
    return target

  return None
Computes a path to the specified package resource.

  Args:
    package_name: A name of the package where the resource is located.
    filepath: A path to the resource relative to the package location.

  Returns:
    A path to the resource or `None` if the resource cannot be found.