docs: def determine(chord, key, shorthand=False):
      """Determine the harmonic function of chord in key.
  
      This function can also deal with lists of chords.
  
      Examples:
      >>> determine(['C', 'E', 'G'], 'C')
      ['tonic']
      >>> determine(['G', 'B', 'D'], 'C')
      ['dominant']
      >>> determine(['G', 'B', 'D', 'F'], 'C', True)
      ['V7']
      >>> determine([['C', 'E', 'G'], ['G', 'B', 'D']], 'C', True)
      [['I'], ['V']]
      """
      result = []
  
      # Handle lists of chords
      if type(chord[0]) == list:
          for c in chord:
              result.append(determine(c, key, shorthand))
          return result
  
      func_dict = {
          'I': 'tonic',
          'ii': 'supertonic',
          'iii': 'mediant',
          'IV': 'subdominant',
          'V': 'dominant',
          'vi': 'submediant',
          'vii': 'subtonic',
          }
      expected_chord = [
          ['I', 'M', 'M7'],
          ['ii', 'm', 'm7'],
          ['iii', 'm', 'm7'],
          ['IV', 'M', 'M7'],
          ['V', 'M', '7'],
          ['vi', 'm', 'm7'],
          ['vii', 'dim', 'm7b5'],
          ]
      type_of_chord = chords.determine(chord, True, False, True)
      for chord in type_of_chord:
          name = chord[0]
  
          # Get accidentals
          a = 1
          for n in chord[1:]:
              if n == 'b':
                  name += 'b'
              elif n == '#':
                  name += '#'
              else:
                  break
              a += 1
          chord_type = chord[a:]
  
          # Determine chord function
          (interval_type, interval) = intervals.determine(key, name).split(' ')
          if interval == 'unison':
              func = 'I'
          elif interval == 'second':
              func = 'ii'
          elif interval == 'third':
              func = 'iii'
          elif interval == 'fourth':
              func = 'IV'
          elif interval == 'fifth':
              func = 'V'
          elif interval == 'sixth':
              func = 'vi'
          elif interval == 'seventh':
              func = 'vii'
  
          # Check whether the chord is altered or not
          for x in expected_chord:
              if x[0] == func:
                  # Triads
                  if chord_type == x[1]:
                      if not shorthand:
                          func = func_dict[func]
                  elif chord_type == x[2]:
                      # Sevenths
                      if shorthand:
                          func += '7'
                      else:
                          func = func_dict[func] + ' seventh'
                  else:
                      # Other
                      if shorthand:
                          func += chord_type
                      else:
                          func = func_dict[func]\
                               + chords.chord_shorthand_meaning[chord_type]
  
          # Handle b's and #'s (for instance Dbm in key C is bII)
          if shorthand:
              if interval_type == 'minor':
                  func = 'b' + func
              elif interval_type == 'augmented':
                  func = '#' + func
              elif interval_type == 'diminished':
                  func = 'bb' + func
          else:
              if interval_type == 'minor':
                  func = 'minor ' + func
              elif interval_type == 'augmented':
                  func = 'augmented ' + func
              elif interval_type == 'diminished':
                  func = 'diminished ' + func
  
          # Add to results
          result.append(func)
      return result