human
Complete this python program:
def create_scenario(actions, logs=None):
assistant
#Here is the Python code you requested.

    """Creates a scenario for a stack of actions
    Each action can be "gap" meaning there is no previous link, "invalid"
    meaning we should simulate an invalid digest, "missing" meaning we
    should simulate a digest is missing from S3, "bucket_change" meaning
    it is a link but the bucket is different than the previous bucket.
    Values are popped one by one off of the list until a terminal "gap"
    action is found.
    """
    keys = [str(i) for i in range(len(actions))]
    key_provider = create_mock_key_provider(keys)
    digest_provider = MockDigestProvider(actions, logs)
    digest_validator = Mock()
    def validate(bucket, key, public_key, digest_data, digest_str):
        if ('_invalid' in digest_data):
            raise DigestError('invalid    error')
    digest_validator.validate = validate
    return (key_provider, digest_provider, digest_validator)