<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def locate_package_entry_file(working_dir, package_name):
 """ Locate a single npm package to return its browser or main entry. """


    basedir = join(working_dir, 'node_modules', package_name)
    package_json = join(basedir, 'package.json')
    if not exists(package_json):
        logger.debug(
            "could not locate package.json for the npm package '%s' in the "
            "current working directory '%s'; the package may have been "
            "not installed, the build process may fail",
            package_name, working_dir,
        )
        return

    with open(package_json) as fd:
        package_info = json.load(fd)

    if ('browser' in package_info or 'main' in package_info):
        # assume the target file exists because configuration files
        # never lie /s
        return join(
            basedir,
            *(package_info.get('browser') or package_info['main']).split('/')
        )

    index_js = join(basedir, 'index.js')
    if exists(index_js):
        return index_js

    logger.debug(
        "package.json for the npm package '%s' does not contain a main "
        "entry point", package_name,
    )