code: def _get_head_id(cls, request):
          
          head_id = request.url.query.get('head', None)
  
          if head_id is not None:
              cls._validate_id(head_id)
  
          return head_id
docs: Fetches the request's head query, and validates if present.