def get_in_samples ( samples , fn ) : for sample in samples : sample = to_single_data ( sample ) if fn ( sample , None ) : return fn ( sample ) return None
how to efficiently return multiple values within a function in python
for a list of samples return the value of a global option
def get_in_samples(samples, fn):
    """
    for a list of samples, return the value of a global option
    """
    for sample in samples:
        sample = to_single_data(sample)
        if fn(sample, None):
            return fn(sample)
    return None