yields all non-empty lines in a file

def get_source(path):
    ''' yields all non-empty lines in a file '''
    for line in read(path):
        if 'import' in line or len(line.strip()) == 0 or line.startswith('#'):
            continue
        if '__name__' in line and '__main__' in line:
            break
        else:
            yield line