code: def as_chord(chord):
      
      if isinstance(chord, Chord):
          return chord
      elif isinstance(chord, str):
          return Chord(chord)
      else:
          raise TypeError("input type should be str or Chord instance.")
docs: convert from str to Chord instance if input is str
  
      :type chord: str|pychord.Chord
      :param chord: Chord name or Chord instance
      :rtype: pychord.Chord
      :return: Chord instance