def read_version(fn):
    """Extract mirGFF3 version"""
    with open(fn) as inh:
        for line in inh:
            if line.find('VERSION') > -1:
                return line.split('VERSION')[1].strip()
            if not line.startswith('#'):
                ValueError(
                    'Version not found in the header.A valid file should have a line like this:## mirGFF3. VERSION X.X'
                    )
