code: def getlayer(self, cls, nb=1, _track=None):
          
          if type(cls) is int:
              nb = cls+1
              cls = None
          if type(cls) is str and "." in cls:
              ccls,fld = cls.split(".",1)
          else:
              ccls,fld = cls,None
          if cls is None or self.__class__ == cls or self.__class__.name == ccls:
              if nb == 1:
                  if fld is None:
                      return self
                  else:
                      return self.getfieldval(fld)
              else:
                  nb -=1
          for f in self.packetfields:
              fvalue_gen = self.getfieldval(f.name)
              if fvalue_gen is None:
                  continue
              if not f.islist:
                  fvalue_gen = SetGen(fvalue_gen,_iterpacket=0)
              for fvalue in fvalue_gen:
                  if isinstance(fvalue, Packet):
                      track=[]
                      ret = fvalue.getlayer(cls, nb, _track=track)
                      if ret is not None:
                          return ret
                      nb = track[0]
          return self.payload.getlayer(cls,nb,_track=_track)
docs: Return the nb^th layer that is an instance of cls.