def get_recursively(structure, keychain):
    """Get a value from a recursive structure."""

    val = structure

    # Follow the key chain to recursively find the value
    for key in keychain.split('.'):
        if isinstance(val, dict) and key in val:
            val = val[key]
        elif key.isdigit() and isinstance(val, list) and int(key) < len(val):
            val = val[int(key)]
        else:
            return None

    return val