def server_url(server_name, download=False):
    """Determine the server URL to download packages from."""
    server_name = server_name.lower()
    if server_name in ['testpypi', 'pypitest']:
        if download:
            return 'https://test.pypi.org/simple'
        else:
            return 'https://test.pypi.org/legacy/'
    elif server_name in ['pypi']:
        return 'https://pypi.org/pypi'
