docs: def paginate_data(searched_data, request_data):
      """
      Paginates the searched_data as per the request_data
      Source: Himanshu Shankar (https://github.com/iamhssingh)
      Parameters
      ----------
      searched_data: Serializer.data
                      It is the data received from queryset. It uses
                      show_serializer
      request_data: Serializer.data
                      It is the request data. It uses serializer_class.
  
      Returns
      -------
      data: dict
      """
      from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
  
      if int(request_data.data['paginator']) > 0:
          paginator = Paginator(searched_data.data,
                                request_data.data['paginator'])
          try:
              curr = paginator.page(request_data.data['page'])
          except PageNotAnInteger:
              curr = paginator.page(1)
          except EmptyPage:
              curr = paginator.page(paginator.num_pages)
  
          data = {'total_pages': paginator.num_pages, 'current': curr.number,
                  'total_objects': len(searched_data.data)}
          if curr.has_next():
              data['next'] = curr.next_page_number()
          else:
              data['next'] = -1
  
          if curr.number > 1:
              data['previous'] = curr.previous_page_number()
          else:
              data['previous'] = -1
          data['objects'] = curr.object_list
      else:
          data = {'objects': searched_data.data, 'previous': -1, 'next': -1,
                  'total_pages': 1, 'current': 1,
                  'total_objects': len(searched_data.data)}
      return data