def METHOD_NAME(self, s3_bucket, s3_key, data, dryrun=True, md5=None, public_read=True):
    """
    Upload a document to S3.
    :param s3_bucket: bucket
    :param s3_key: s3 key
    :param data: byte encoded data
    :param dryrun: don't actually upload, just print and exit
    :param md5: md5 checksum of the file
    :param public_read: make the files publicly readable
    """
    try:
        if not dryrun:
            object = boto3.resource("s3", region_name=self._region, **self._credentials).Object(s3_bucket, s3_key)
            extra_args = {}
            if md5:
                extra_args["ContentMD5"] = md5
            if public_read:
                extra_args["ACL"] = "public-read"
            object.put(Body=data, **extra_args)
        else:
            logging.info(
                "Dryrun mode enabled. The following file would have been uploaded to s3://%s/%s:\n%s",
                s3_bucket,
                s3_key,
                data,
            )
    except Exception as e:
        self.error(
            f"Failed when uploading file {s3_key} to bucket {s3_bucket} in region {self._region} with error {e}"
        )
        raise