def _is_namespace_visible(context, namespace):
    """Return true if namespace is visible in this context"""
    if context.is_admin:
        return True
    if namespace.get('visibility', '') == 'public':
        return True
    if namespace['owner'] is None:
        return True
    if context.owner is not None:
        if context.owner == namespace['owner']:
            return True
    return False
