code: def generate_token(self, *args, **kwargs):
          
          # determine the length based on min_length and max_length
          length = random.randint(self.min_length, self.max_length)
  
          # generate the token using os.urandom and hexlify
          return binascii.hexlify(
              os.urandom(self.max_length)
          ).decode()[0:length]
docs: generates a pseudo random code using os.urandom and binascii.hexlify