def find_method(interfaces, interface_name, method_name, version):
    matching_interfaces = filter(lambda interface: interface['name'] == interface_name, interfaces)
    if len(matching_interfaces) < 1:
        return (None, None)

    interface = matching_interfaces[0]
    methods = interface['methods']
    matching_methods = filter(lambda method: method['name'] == method_name, methods)
    if len(matching_methods) < 1:
        return (interface, None)

    if version is None:
        version = max(map(itemgetter('version'), matching_methods))

    matching_methods = filter(lambda method: method['version'] == version, matching_methods)
    if len(matching_methods) < 1:
        return (interface, None)

    return (interface, matching_methods[0])
dataset/ETHPy150Open UberEnt/SteamCLI/steamcli.py/find_method/original