def mkdir(self, dest): """Make a directory. This doesn't actually create directories on S3 (because there is no such thing), but it will create the corresponding bucket if it doesn't exist. """ bucket_name, key_name = parse_s3_uri(dest) client = self.make_s3_client() try: client.head_bucket(Bucket=bucket_name) except botocore.exceptions.ClientError as ex: if _client_error_status(ex) != 404: raise self.create_bucket(bucket_name)