# Buggy code
def exists(self, location: str, **kwargs: Any) -> bool:
    """
    Checks whether the target result exists in the S3 bucket.

    Does not validate whether the result is `valid`, only that it is present.

    Args:
        - location (str): Location of the result in the specific result target.
        - **kwargs (Any): string format arguments for `location`

    Returns:
        - bool: whether or not the target result exists.
    """
    import botocore

    try:
        self.client.get_object(Bucket=self.bucket, Key=location.format(**kwargs)).load()
    except botocore.exceptions.ClientError as exc:
        if exc.response["Error"]["Code"] == "404":
            return False
        raise
    except Exception as exc:
        self.logger.exception(
            "Unexpected error while reading from S3: {}".format(repr(exc))
        )
        raise
    return True


# Traceback (botocore.errorfactory.NoSuchKey)
[2020-05-16 21:31:37] INFO - prefect.FlowRunner | Beginning Flow run for 'Our first flow'
[2020-05-16 21:31:37] INFO - prefect.FlowRunner | Starting flow run.
[2020-05-16 21:31:37] INFO - prefect.TaskRunner | Task 'tsx_url': Starting task run...
[2020-05-16 21:31:37] INFO - prefect.TaskRunner | Task 'tsx_url': finished task run for task with final state: 'Success'
[2020-05-16 21:31:37] INFO - prefect.TaskRunner | Task 'get_tsx_moc_imb': Starting task run...
[2020-05-16 21:31:38] ERROR - prefect.TaskRunner | Unexpected error: NoSuchKey('An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.')
Traceback (most recent call last):
File "/home/ilivni/miniconda3/envs/py37moc/lib/python3.7/site-packages/prefect/engine/runner.py", line 48, in inner
new_state = method(self, state, *args, **kwargs)
File "/home/ilivni/miniconda3/envs/py37moc/lib/python3.7/site-packages/prefect/engine/task_runner.py", line 651, in check_target
if result.exists(target, **prefect.context):
File "/home/ilivni/miniconda3/envs/py37moc/lib/python3.7/site-packages/prefect/engine/results/s3_result.py", line 167, in exists
Bucket=self.bucket, Key=location.format(**kwargs)
File "/home/ilivni/miniconda3/envs/py37moc/lib/python3.7/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/home/ilivni/miniconda3/envs/py37moc/lib/python3.7/site-packages/botocore/client.py", line 626, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.
[2020-05-16 21:31:38] INFO - prefect.TaskRunner | Task 'get_tsx_moc_imb': finished task run for task with final state: 'Skipped'
[2020-05-16 21:31:38] INFO - prefect.FlowRunner | Flow run SUCCESS: all reference tasks succeeded

# Fixed code
def exists(self, location: str, **kwargs: Any) -> bool:
    """
    Checks whether the target result exists in the S3 bucket.

    Does not validate whether the result is `valid`, only that it is present.

    Args:
        - location (str): Location of the result in the specific result target.
        - **kwargs (Any): string format arguments for `location`

    Returns:
        - bool: whether or not the target result exists.
    """
    import botocore

    try:
        self.client.get_object(Bucket=self.bucket, Key=location.format(**kwargs)).load()
    except botocore.exceptions.ClientError as exc:
        if exc.response["Error"]["Code"] == "NoSuchKey":
            return False
        raise
    except Exception as exc:
        self.logger.exception(
            "Unexpected error while reading from S3: {}".format(repr(exc))
        )
        raise
    return True