from typing import Optional


def _find_mark(instrumented_config: dict, path: str) -> Optional[dict]:
    """
    Find mark in instrumented config by path
    :param instrumented_config: { field1: 'a', field2: 'b', '__line__': 0, '__field1__': {
        'start': {'line': 1, 'column': 1}, 'end': {...}
    }}
    :param path: field1.0.field2.1
    :return: {'start': {'line': 1, 'column': 1}, 'end': {...}}
    """
    value = instrumented_config
    mark = None
    for key in path.split('.'):
        if isinstance(value, dict):
            mark = value.get(f'__{key}__')
            value = value.get(key)
        elif isinstance(value, list):
            value = value[int(key)]
            mark = value.get('__item__')

    return mark