See also  https://github.com/localstack/localstack/blob/master/localstack/services/dynamodbstreams/dynamodbstreams_api.py#L70 
if not message:
        message = 'Unknown error'
    if not error_type:
        error_type = 'UnknownError'
    if 'com.amazonaws.dynamodb' not in error_type:
        error_type = 'com.amazonaws.dynamodb.v20120810#%s' % error_type
    content = {
        'message': message,
        '__type': error_type
    }
    return make_response(jsonify(content), code)
def get_kinesis_stream_name(table_name):
    return DDB_KINESIS_STREAM_NAME_PREFIX + table_name
def table_name_from_stream_arn(stream_arn):
    return stream_arn.split(':table/')[1].split('/')[0]
def stream_name_from_stream_arn(stream_arn):
    table_name = table_name_from_stream_arn(stream_arn)
    return get_kinesis_stream_name(table_name)
def random_id(stream_arn, kinesis_shard_id):
    namespace = uuid.UUID(bytes=hashlib.sha1(to_bytes(stream_arn)).digest()[:16])
    if six.PY2:
        kinesis_shard_id = to_bytes(kinesis_shard_id, 'utf-8')
    return uuid.uuid5(namespace, kinesis_shard_id).hex
def shard_id(stream_arn, kinesis_shard_id):
    return '-'.join([kinesis_shard_id, random_id(stream_arn, kinesis_shard_id)])
def kinesis_shard_id(dynamodbstream_shard_id):
    return dynamodbstream_shard_id.rsplit('-', 1)[0]
def serve(port, quiet=True):
    generic_proxy.serve_flask_app(app=app, port=port, quiet=quiet)