docs: def generate_sync_h5_file(in_paths, channels=('channel_1', 'channel_1'), new_path='sync_file.h5'):
      """
      -----
      Brief
      -----
      This function allows to generate a h5 file with synchronised signals from the input file(s).
  
      -----------
      Description
      -----------
      OpenSignals files follow a specific structure that allows to analyse all files in the same way. Furthermore, it
      allows those files to be opened and analysed in the OpenSignals software without the need of programming.
  
      This functions takes one or two files, synchronises the signals in channels and generates a new file in the new
      path.
  
      ----------
      Parameters
      ----------
      in_paths : str or list
          If the input is a string, it is assumed that the two signals are in the same file, else, if the input is a list,
          it is assumed that the two signals are in different file (the list should contain the paths to the two files).
      channels : list
          List with the strings identifying the channels of each signal. (default: ("channel_1", "channel_1"))
      new_path : str
          The path to create the new file. (default: 'sync_file.h5')
      """
  
      if type(in_paths) == list or type(in_paths) == str:
          new_file = _create_h5_file(in_paths, new_path)
      else:
          raise TypeError('The path should be a list of str or a str.')
  
      data, devices = [[], []]
      for j, i in enumerate(list(new_file.keys())):
          devices.append(i)
          data.append(np.concatenate(new_file[i].get('raw').get(channels[j]))[:])
      phase, s1, s2 = synchronise_signals(data[0], data[1])
  
      if np.array_equal(s1, data[0]):
          # Change the second device
          new_device = new_file[devices[1]]
      elif np.array_equal(s2, data[1]):
          # Change the first device
          new_device = new_file[devices[0]]
      raw_digital = ['raw', 'digital', 'support']
      for r_d in raw_digital:
          raw_di = new_device[r_d]
          for key in list(raw_di.keys()):
              if r_d != 'support':
                  signal = list(raw_di[key])[phase:]
                  attribute = list(raw_di[key].attrs.items())
                  del raw_di[key]
                  raw_di.create_dataset(name=key, data=np.array(signal, dtype=np.int32))
                  for a in attribute:
                      raw_di[key].attrs.__setitem__(name=a[0], value=a[1])
              else:
                  for other_key in list(raw_di[key].keys()):
                      channel = raw_di[key][other_key]
                      level = int(key.split('_')[-1])
                      for yak in list(channel.keys()):
                          if yak is not 't':
                              data_aux = list(channel[yak])[int(np.ceil(phase/level)):]
                          else:
                              data_aux = list(channel[yak])[:len(channel[yak][:])-int(np.ceil(phase / level))]
                          del channel[yak]
                          channel.create_dataset(name=yak, data=np.array(data_aux))
  
      length = abs(len(new_file[devices[0]]['raw']['channel_1']) - len(new_file[devices[1]]['raw']['channel_1']))
  
      if len(new_file[devices[0]]['raw']['channel_1']) > len(new_file[devices[1]]['raw']['channel_1']):
          index = 1
      else:
          index = 0
  
      for r_d in raw_digital:
          raw_di = new_file[devices[index]][r_d]
          for key in list(raw_di.keys()):
              if r_d != 'support':
                  if 'channel' in key or 'digital' in key:
                      signal = np.concatenate([list(raw_di[key]), np.zeros([length, 1])])
                  elif 'nSeq' in key:
                      signal = np.arange(len(raw_di[key]) + length)
                  attribute = list(raw_di[key].attrs.items())
                  del raw_di[key]
                  raw_di.create_dataset(name=key, data=np.array(signal, dtype=np.int32))
                  for a in attribute:
                      raw_di[key].attrs.__setitem__(name=a[0], value=a[1])
              else:
                  for other_key in list(raw_di[key].keys()):
                      channel = raw_di[key][other_key]
                      level = int(key.split('_')[-1])
                      for yak in list(channel.keys()):
                          if yak is not 't':
                              data_aux = np.vstack([list(channel[yak]),
                                                    np.zeros(int(length / level)).reshape(-1, 1)])
                          else:
                              data_aux = np.arange(0, len(channel[yak][:])+length//level).reshape(-1, 1)*level
  
                          del channel[yak]
                          channel.create_dataset(name=yak, data=np.array(data_aux, dtype=int))
  
      final_length = len(np.ravel(signal))
      for i in list(new_file.keys()):
          new_file[i].attrs['duration'] = str(int(final_length // new_file[i].attrs['sampling rate'])) + ' s'
          new_file[i].attrs.modify(name='nsamples', value=int(final_length))
      new_file.close()