@staticmethod<EOL><INDENT>def _parse_s3_location(location):<DEDENT>
bucket, key, version = None, None, None<EOL>if isinstance(location, dict):<EOL><INDENT>bucket, key, version = (<EOL>location.get("<STR_LIT>"),<EOL>location.get("<STR_LIT>"),<EOL>location.get("<STR_LIT>")<EOL>)<EOL><DEDENT>elif isinstance(location, string_types) and location.startswith("<STR_LIT>"):<EOL><INDENT>parsed = urlparse(location)<EOL>query = parse_qs(parsed.query)<EOL>bucket = parsed.netloc<EOL>key = parsed.path.lstrip('<STR_LIT:/>')  <EOL>if query and '<STR_LIT>' in query and len(query['<STR_LIT>']) == <NUM_LIT:1>:<EOL><INDENT>version = query['<STR_LIT>'][<NUM_LIT:0>]<EOL><DEDENT><DEDENT>return bucket, key, version<EOL>
Parses the given location input as a S3 Location and returns the file's bucket, key and version as separate
values. Input can be in two different formats:

1. Dictionary with ``Bucket``, ``Key``, ``Version`` keys
2. String of S3 URI in format ``s3://<bucket>/<key>?versionId=<version>``

If the input is not in either of the above formats, this method will return (None, None, None) tuple for all
the values.

Parameters
----------
location : str or dict
    Location of the S3 file

Returns
-------
str
    Name of the S3 Bucket. None, if bucket value was not found
str
    Key of the file from S3. None, if key was not provided
str
    Optional Version ID of the file. None, if version ID is not provided