<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_queryset(self):
 """ Optionally restricts the returned devices by filtering against a `search` query parameter in the URL. """

        # retrieve all devices which are published and accessible to current user
        # and use joins to retrieve related fields
        queryset = super(DeviceList, self).get_queryset()#.select_related('layer', 'status', 'user')

        # retrieve value of querystring parameter "search"
        search = self.request.query_params.get('search', None)

        if search is not None:
            search_query = (
                Q(name__icontains=search) |
                Q(description__icontains=search)
            )
            # add instructions for search to queryset
            queryset = queryset.filter(search_query)

        return queryset