'Given a file, upload it to S3.
Credentials should be stored in environment variables or ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows).
Returns True on success, false on failure.'

def upload_to_s3(self, source_path, bucket_name, disable_progress=False):

    try:
        self.s3_client.head_bucket(Bucket=bucket_name)
    except botocore.exceptions.ClientError:
        if (self.aws_region == 'us-east-1'):
            self.s3_client.create_bucket(Bucket=bucket_name)
        else:
            self.s3_client.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={'LocationConstraint': self.aws_region})
    if ((not os.path.isfile(source_path)) or (os.stat(source_path).st_size == 0)):
        print('Problem    with    source    file    {}'.format(source_path))
        return False
    dest_path = os.path.split(source_path)[1]
    try:
        source_size = os.stat(source_path).st_size
        print('Uploading    {0}    ({1})..'.format(dest_path, human_size(source_size)))
        progress = tqdm(total=float(os.path.getsize(source_path)), unit_scale=True, unit='B', disable=disable_progress)
        try:
            self.s3_client.upload_file(source_path, bucket_name, dest_path, Callback=progress.update)
        except Exception as e:
            self.s3_client.upload_file(source_path, bucket_name, dest_path)
        progress.close()
    except (KeyboardInterrupt, SystemExit):
        raise
    except Exception as e:
        print(e)
        return False
    return True
