from typing import List
from typing import Optional


def find_object(objects: List[object], **filters) -> Optional[object]:
    """
    Pass a list of objects and filters as kwargs to get first occurence record. If no filters
    passed return first object in the list

    Args:
        objects: list of objects to iterate and filter from
        **filters: kwargs to be used for filtering as key:value pairs
    Returns:
        Found record obj or None
    Examples:
        >>> class A:
        ...     def __init__(self, var1, var2, var3=False):
        ...         self.var1, self.var2, self.var3 = var1, var2, var3
        ...     def __repr__(self):
        ...         return f'{self.var1}-{self.var2}'
        ...
        >>> find_object([A('test', 1), A('test2', 2)],  var1='test', var2=1)
        test-1
        >>> find_object([A('test', 1), A('test2', 2)], var1='test', var2=2) is None
        True
        >>> find_object([{}])
        {}
        """
    for rec in objects:
        if all([getattr(rec, key) == value for key, value in filters.items()]):
            return rec