from typing import OrderedDict


def get_mapped_meta(meta, mapped):
    """ Returns a subset of the meta object as indicated by the given mapped
    meta syntax.

    mapped should be a mapped meta string.
    """

    steps = mapped.split('@')
    key = steps.pop()
    for step in steps:
        if isinstance(meta, list):
            step = int(step)
        meta = meta[step]

    if key in meta:
        if isinstance(meta[key], (dict, OrderedDict)):
            meta = {key: meta[key]}
        else:
            meta = meta[key]

    return meta