<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ls(manager: Manager, url: Optional[str], namespace_id: Optional[int]):
 """List cached namespaces."""

    if url:
        n = manager.get_or_create_namespace(url)
        if isinstance(n, Namespace):
            _page(n.entries)
        else:
            click.echo('uncachable namespace')
    elif namespace_id is not None:
        _ls(manager, Namespace, namespace_id)
    else:
        click.echo('Missing argument -i or -u')