docs: def update_legacy_file(fname):
          """ Update a fast5 file from an older version to the new standard.
          
          :param fname: The filename of the fast5 file.
          """
          status = Fast5Info(fname)
          if not status.valid:
              raise IOError('Cannot update invalid file: {}'.format(fname))
          with h5py.File(fname, 'r+') as handle:
              # Add Raw/Read/Read_## groups for reads if they are missing.
              for read_info in status.read_info:
                  read_group_name = 'Raw/Reads/Read_{}'.format(read_info.read_number)
                  if read_group_name in handle:
                      rgh = handle[read_group_name]
                  else:
                      rgh = handle.create_group(read_group_name)
                  rgh.attrs['read_number'] = read_info.read_number
                  rgh.attrs['read_id'] = read_info.read_id
                  rgh.attrs['duration'] = read_info.duration
                  rgh.attrs['start_time'] = read_info.start_time
                  rgh.attrs['start_mux'] = read_info.start_mux
  
              # Add the Analyses and tracking_id groups, if they are missing.
              if not 'Analyses' in handle:
                  handle.create_group('Analyses')
              if not 'tracking_id' in handle['UniqueGlobalKey']:
                  handle.create_group('UniqueGlobalKey/tracking_id')
  
              # Update the EventDetection_000 created by old versions of MinKNOW, if needed.
              if status.version < 1.1:
                  if 'Analyses/EventDetection_000' in handle:
                      reads_group = handle['Analyses/EventDetection_000/Reads']
                      data_group_names = reads_group.keys()
                      for data_group_name in data_group_names:
                          read_group = reads_group[data_group_name]
                          read_number = read_group.attrs['read_number']
                          read_info = status.read_info[status.read_number_map[read_number]]
                          read_group.attrs['read_id'] = read_info.read_id
                          if 'Events' in read_group:
                              dataset = read_group['Events']
                              if 'variance' in dataset.dtype.names:
                                  old_data = read_group['Events'][()]
                                  new_data = np.empty(old_data.size, dtype=[('mean', float), ('stdv', float),
                                                                            ('start', int), ('length', int)])
                                  new_data[:]['mean'] = old_data['mean']
                                  new_data[:]['stdv'] = np.sqrt(old_data['variance'])
                                  new_data[:]['start'] = old_data['start']
                                  new_data[:]['length'] = old_data['length']
                                  del read_group['Events']
                                  read_group.create_dataset('Events', data=new_data, compression='gzip')
  
              # Update the version number.
              handle.attrs['file_version'] = CURRENT_FAST5_VERSION