def put(self, key, obj, overwrite=True):
    '\n        Put an object to S3.\n\n        Args:\n            key:       (required) suffix for the object.\n            obj:       (required) a bytes, string, or a unicode object to \n                       be stored in S3.\n            overwrite: (optional) overwrites the key with obj, if it exists\n\n        Returns:\n            an S3 URL corresponding to the object stored.\n        '
    if (not is_stringish(obj)):
        raise MetaflowS3InvalidObject(("Object corresponding to the key '%s' is not a string or a bytes object." % key))
    url = self._url(key)
    src = urlparse(url)

    def _upload(s3, tmp):
        blob = to_fileobj(obj)
        s3.upload_fileobj(blob, src.netloc, src.path.lstrip('/'))
    if overwrite:
        self._one_boto_op(_upload, url)
        return url
    else:

        def _head(s3, tmp):
            s3.head_object(Bucket=src.netloc, Key=src.path.lstrip('/'))
        try:
            self._one_boto_op(_head, url)
        except MetaflowS3NotFound as err:
            self._one_boto_op(_upload, url)
        return url
Put an object to S3.

Args:
    key:       (required) suffix for the object.
    obj:       (required) a bytes, string, or a unicode object to 
               be stored in S3.
    overwrite: (optional) overwrites the key with obj, if it exists

Returns:
    an S3 URL corresponding to the object stored.
def put(self, key, obj, overwrite=True):
    '\n        Put an object to S3.\n\n        Args:\n            key:       (required) suffix for the object.\n            obj:       (required) a bytes, string, or a unicode object to \n                       be stored in S3.\n            overwrite: (optional) overwrites the key with obj, if it exists\n\n        Returns:\n            an S3 URL corresponding to the object stored.\n        '
    if (not is_stringish(obj)):
        raise MetaflowS3InvalidObject(("Object corresponding to the key '%s' is not a string or a bytes object." % key))
    url = self._url(key)
    src = urlparse(url)

    def _upload(s3, tmp):
        blob = to_fileobj(obj)
        s3.upload_fileobj(blob, src.netloc, src.path.lstrip('/'))
    if overwrite:
        self._one_boto_op(_upload, url)
        return url
    else:

        def _head(s3, tmp):
            s3.head_object(Bucket=src.netloc, Key=src.path.lstrip('/'))
        try:
            self._one_boto_op(_head, url)
        except MetaflowS3NotFound as err:
            self._one_boto_op(_upload, url)
        return url