docs: def dcmanonym(
          dcmpth,
          displayonly=False,
          patient='anonymised',
          physician='anonymised',
          dob='19800101',
          verbose=True):
  
      ''' Anonymise DICOM file(s)
          Arguments:
          > dcmpth:   it can be passed as a single DICOM file, or
                      a folder containing DICOM files, or a list of DICOM file paths.
          > patient:  the name of the patient.
          > physician:the name of the referring physician.
          > dob:      patient's date of birth.
          > verbose:  display processing output.
      '''
  
      #> check if a single DICOM file
      if isinstance(dcmpth, basestring) and os.path.isfile(dcmpth):
          dcmlst = [dcmpth]
          if verbose:
              print 'i> recognised the input argument as a single DICOM file.'
  
      #> check if a folder containing DICOM files
      elif isinstance(dcmpth, basestring) and os.path.isdir(dcmpth):
          dircontent = os.listdir(dcmpth)
          #> create a list of DICOM files inside the folder
          dcmlst = [os.path.join(dcmpth,d) for d in dircontent if os.path.isfile(os.path.join(dcmpth,d)) and d.endswith(dcmext)]
          if verbose:
              print 'i> recognised the input argument as the folder containing DICOM files.'
  
      #> check if a folder containing DICOM files
      elif isinstance(dcmpth, list):
          if not all([os.path.isfile(d) and d.endswith(dcmext) for d in dcmpth]):
              raise IOError('Not all files in the list are DICOM files.')
          dcmlst = dcmpth
          if verbose:
              print 'i> recognised the input argument as the list of DICOM file paths.'
  
      #> check if dictionary of data input <datain>
      elif isinstance(dcmpth, dict) and 'corepath' in dcmpth:
          dcmlst = list_dcm_datain(dcmpth)
          if verbose:
              print 'i> recognised the input argument as the dictionary of scanner data.'
  
      else:
          raise IOError('Unrecognised input!')
  
  
  
      for dcmf in dcmlst:
  
          #> read the file
          dhdr = dcm.dcmread(dcmf)
  
          #> get the basic info about the DICOM file
          dcmtype = dcminfo(dhdr, verbose=False)
          if verbose:
              print '-------------------------------'
              print 'i> the DICOM file is for:', dcmtype
  
          #> anonymise mMR data.
          if 'mmr' in dcmtype:
  
              if [0x029, 0x1120] in dhdr and dhdr[0x029, 0x1120].name=='[CSA Series Header Info]':
                  csafield = dhdr[0x029, 0x1120]
                  csa = csafield.value
              elif [0x029, 0x1020] in dhdr and dhdr[0x029, 0x1020].name=='[CSA Series Header Info]':
                  csafield = dhdr[0x029, 0x1020]
                  csa = csafield.value
              else:
                  csa = ''
  
              # string length considered for replacement
              strlen = 200
              
              idx = [m.start() for m in re.finditer(r'([Pp]atients{0,1}[Nn]ame)', csa)]
              if idx and verbose:
                  print '   > found sensitive information deep in DICOM headers:', dcmtype
  
  
              #> run the anonymisation    
              iupdate = 0
  
              for i in idx:
                  ci = i - iupdate
  
                  if displayonly:
                      print '   > sensitive info:'
                      print '    ', csa[ci:ci+strlen]
                      continue
  
                  rplcmnt = re.sub( r'(\{\s*\"{1,2}\W*\w+\W*\w+\W*\"{1,2}\s*\})',
                          '{ ""' +patient+ '"" }',
                           csa[ci:ci+strlen]
                  )
                  #> update string
                  csa = csa[:ci] + rplcmnt + csa[ci+strlen:]
                  print '   > removed sensitive information.'
                  #> correct for the number of removed letters
                  iupdate = strlen-len(rplcmnt)
  
              #> update DICOM
              if not displayonly and csa!='':
                  csafield.value = csa
  
  
          #> Patient's name
          if [0x010,0x010] in dhdr:
              if displayonly:
                  print '   > sensitive info:', dhdr[0x010,0x010].name
                  print '    ', dhdr[0x010,0x010].value
              else:
                  dhdr[0x010,0x010].value = patient
                  if verbose: print '   > anonymised patients name'
  
          #> date of birth
          if [0x010,0x030] in dhdr:
              if displayonly:
                  print '   > sensitive info:', dhdr[0x010,0x030].name
                  print '    ', dhdr[0x010,0x030].value
              else:
                  dhdr[0x010,0x030].value = dob
                  if verbose: print '   > anonymised date of birh'
  
          #> physician's name
          if [0x008, 0x090] in dhdr:
              if displayonly:
                  print '   > sensitive info:',  dhdr[0x008,0x090].name
                  print '    ', dhdr[0x008,0x090].value
              else:
                  dhdr[0x008,0x090].value = physician
                  if verbose: print '   > anonymised physician name'
  
          dhdr.save_as(dcmf)