def _version_from_file(lines):
 is_version_line = (lambda line: line.lower().startswith('version:'))
 version_lines = filter(is_version_line, lines)
 line = next(iter(version_lines), '')
 (_, _, value) = line.partition(':')
 return (safe_version(value.strip()) or None)

def _version_from_file ( lines ) : is_version_line = ( lambda line : line . lower ( ) . startswith ( 'version:' ) ) version_lines = filter ( is_version_line , lines ) line = next ( iter ( version_lines ) , '' ) ( _ , _ , value ) = line . partition ( ':' ) return ( safe_version ( value . strip ( ) ) or None )
given an iterable of lines from a metadata file .