<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def browse(package, homepage):
 """Browse to a package's PyPI or project homepage."""

    p = Package(package)
    try:
        if homepage:
            secho(u'Opening homepage for "{0}"...'.format(package), bold=True)
            url = p.home_page
        else:
            secho(u'Opening PyPI page for "{0}"...'.format(package), bold=True)
            url = p.package_url
    except NotFoundError:
        abort_not_found(package)
    click.launch(url)