import re


def find_child_by_property(obj, obj_type, property_name, property_value, reg_exp_search=False):
    """
    Finds the child of an object which has the property name matching the property value
    of type obj_type
    obj: The property value is searched through obj children
    obj_type: Type of object to be matched
    property_name: Property of the child which should be verified for the required value.
    property_value: Property value that needs to be matched
    reg_exp_search: If True searches for the property_value based on re search. Defaults to False.
    """
    for child in obj.children():
        if reg_exp_search and re.search(property_value, getattr(child, property_name)()):
            return child
        if not reg_exp_search and isinstance(child, obj_type) and getattr(child, property_name)() == property_value:
            return child
    return None