<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def find_permission(
        permissions, permission_type, object_id=None, namespace=None):
    '''Given a queryset of permissions, filters depending on the permission
    type, and optionally an object id and namespace.'''
    if object_id is not None:
        return permissions.filter(
            type=permission_type, object_id=object_id, namespace=namespace)
    return permissions.filter(type=permission_type)