def _url(self, key):
    if (self._s3root is None):
        parsed = urlparse(to_unicode(key))
        if ((parsed.scheme == 's3') and parsed.path):
            return key
        elif current.is_running_flow:
            raise MetaflowS3URLException('Specify S3(run=self) when you use S3 inside a running flow. Otherwise you have to use S3 with full s3:// urls.')
        else:
            raise MetaflowS3URLException("Initialize S3 with an 's3root' or 'run' if you don't want to specify full s3:// urls.")
    elif key:
        if key.startswith('s3://'):
            raise MetaflowS3URLException(("Don't use absolute S3 URLs when the S3 client is initialized with a prefix. URL: %s" % key))
        return os.path.join(self._s3root, key)
    else:
        return self._s3root
def _url(self, key):
    if (self._s3root is None):
        parsed = urlparse(to_unicode(key))
        if ((parsed.scheme == 's3') and parsed.path):
            return key
        elif current.is_running_flow:
            raise MetaflowS3URLException('Specify S3(run=self) when you use S3 inside a running flow. Otherwise you have to use S3 with full s3:// urls.')
        else:
            raise MetaflowS3URLException("Initialize S3 with an 's3root' or 'run' if you don't want to specify full s3:// urls.")
    elif key:
        if key.startswith('s3://'):
            raise MetaflowS3URLException(("Don't use absolute S3 URLs when the S3 client is initialized with a prefix. URL: %s" % key))
        return os.path.join(self._s3root, key)
    else:
        return self._s3root