code: def get_sidecar(fname, allowedfileformats='default'):
      
      if allowedfileformats == 'default':
          allowedfileformats = ['.tsv', '.nii.gz']
      for f in allowedfileformats:
          fname = fname.split(f)[0]
      fname += '.json'
      if os.path.exists(fname):
          with open(fname) as fs:
              sidecar = json.load(fs)
      else:
          sidecar = {}
      if 'filestatus' not in sidecar:
          sidecar['filestatus'] = {}
          sidecar['filestatus']['reject'] = False
          sidecar['filestatus']['reason'] = []
      return sidecar
docs: Loads sidecar or creates one