<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_stream_action_type(stream_arn):
 """Returns the awacs Action for a stream type given an arn Args: stream_arn (str):
 The Arn of the stream. Returns: :class:`awacs.aws.Action`: The appropriate stream type awacs Action class Raises: ValueError: If the stream type doesn't match kinesis or dynamodb. """


    stream_type_map = {
        "kinesis": awacs.kinesis.Action,
        "dynamodb": awacs.dynamodb.Action,
    }

    stream_type = stream_arn.split(":")[2]
    try:
        return stream_type_map[stream_type]
    except KeyError:
        raise ValueError(
            "Invalid stream type '%s' in arn '%s'" % (stream_type, stream_arn)
        )