summaryrefslogtreecommitdiffstats
path: root/deploy/common/query.py
blob: 714abc6aaff9d0b3b41ae455aae1a09fbbdd0b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
##############################################################################
# Copyright (c) 2017 ZTE Coreporation and others.
# feng.xiaowei@zte.com.cn
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################


def find(function, sequence, default=None):
    for s in sequence:
        if function(s):
            return s
    return default