############################################################################## # 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