Executes download request from AWS service
    :param request: A request
    :type request: DownloadRequest
    :return: Response of the request
    :rtype: dict
    :raises: AwsDownloadFailedException, ValueError

def _do_aws_request(request):
    """ Executes download request from AWS service
    :param request: A request
    :type request: DownloadRequest
    :return: Response of the request
    :rtype: dict
    :raises: AwsDownloadFailedException, ValueError
    """
    if SHConfig().aws_access_key_id and SHConfig().aws_secret_access_key:
        key_args = dict(aws_access_key_id=SHConfig().aws_access_key_id,
                        aws_secret_access_key=SHConfig().aws_secret_access_key)
    else:
        key_args = {}
    aws_service, _, bucket_name, url_key = request.url.split('/', 3)

    try:
        s3_client = boto3.Session().client(aws_service.strip(':'), **key_args)
        request.s3_client = s3_client  # Storing the client prevents warning about unclosed socket
        DownloadRequest.GLOBAL_AWS_CLIENT = s3_client
    except KeyError:  # Sometimes creation of client fails and we use the global client if it exists
        if DownloadRequest.GLOBAL_AWS_CLIENT is None:
            raise ValueError('Failed to create a client for download from AWS')
        s3_client = DownloadRequest.GLOBAL_AWS_CLIENT

    try:
        return s3_client.get_object(Bucket=bucket_name, Key=url_key, RequestPayer='requester')
    except NoCredentialsError:
        raise ValueError('The requested data is in Requester Pays AWS bucket. In order to download the data please set '
                         'your access key either in AWS credentials file or in sentinelhub config.json file using '
                         'command line:\n'
                         '$ sentinelhub.config --aws_access_key_id <your AWS key> --aws_secret_access_key '
                         '<your AWS secret key>')
    except s3_client.exceptions.NoSuchKey:
        raise AwsDownloadFailedException('File in location %s is missing' % request.url)
    except s3_client.exceptions.NoSuchBucket:
        raise ValueError('Aws bucket %s does not exist' % bucket_name)