code: def check_bucket_exists(self, bucket: str) -> bool:
          
          exists = True
          try:
              self.s3_client.head_bucket(Bucket=bucket)
          except botocore.exceptions.ClientError as e:
              # If a client error is thrown, then check that it was a 404 error.
              # If it was a 404 error, then the bucket does not exist.
              error_code = int(e.response['Error']['Code'])
              if error_code == 404:
                  exists = False
          return exists
docs: Checks if bucket with specified name exists.
          :param bucket: the bucket to be checked.
          :return: true if specified bucket exists.