code: def set_bucket_policy(self, bucket_name, policy):
          
          is_valid_policy_type(policy)
  
          is_valid_bucket_name(bucket_name)
  
          headers = {
              'Content-Length': str(len(policy)),
              'Content-Md5': get_md5_base64digest(policy)
          }
          content_sha256_hex = get_sha256_hexdigest(policy)
          self._url_open("PUT",
                          bucket_name=bucket_name,
                          query={"policy": ""},
                          headers=headers,
                          body=policy,
                          content_sha256=content_sha256_hex)
docs: Set bucket policy of given bucket name.
  
          :param bucket_name: Bucket name.
          :param policy: Access policy/ies in string format.