@staticmethod<EOL><INDENT>def _download_from_s3(bucket, key, version=None):<DEDENT>
s3 = boto3.client('<STR_LIT>')<EOL>extra_args = {}<EOL>if version:<EOL><INDENT>extra_args["<STR_LIT>"] = version<EOL><DEDENT>with tempfile.TemporaryFile() as fp:<EOL><INDENT>try:<EOL><INDENT>s3.download_fileobj(<EOL>bucket, key, fp,<EOL>ExtraArgs=extra_args)<EOL>fp.seek(<NUM_LIT:0>)<EOL>return fp.read()<EOL><DEDENT>except botocore.exceptions.ClientError:<EOL><INDENT>LOG.error("<STR_LIT>",<EOL>bucket, key, version)<EOL>raise<EOL><DEDENT><DEDENT>
Download a file from given S3 location, if available.

Parameters
----------
bucket : str
    S3 Bucket name

key : str
    S3 Bucket Key aka file path

version : str
    Optional Version ID of the file

Returns
-------
str
    Contents of the file that was downloaded

Raises
------
botocore.exceptions.ClientError if we were unable to download the file from S3