code: def generate_signing_key(date, region, secret_key):
      
      formatted_date = date.strftime("%Y%m%d")
  
      key1_string = 'AWS4' + secret_key
      key1 = key1_string.encode('utf-8')
      key2 = hmac.new(key1, formatted_date.encode('utf-8'),
                      hashlib.sha256).digest()
      key3 = hmac.new(key2, region.encode('utf-8'), hashlib.sha256).digest()
      key4 = hmac.new(key3, 's3'.encode('utf-8'), hashlib.sha256).digest()
  
      return hmac.new(key4, 'aws4_request'.encode('utf-8'),
                      hashlib.sha256).digest()
docs: Generate signing key.
  
      :param date: Date is input from :meth:`datetime.datetime`
      :param region: Region should be set to bucket region.
      :param secret_key: Secret access key.