code: def from_Bar(bar, showkey=True, showtime=True):
      
      # Throw exception
      if not hasattr(bar, 'bar'):
          return False
  
      # Process the key
      if showkey:
          key_note = Note(bar.key.key[0].upper() + bar.key.key[1:])
          key = '\\key %s \\%s ' % (from_Note(key_note, False, standalone=False), bar.key.mode)
          result = key
      else:
          result = ''
  
      # Handle the NoteContainers
      latest_ratio = (1, 1)
      ratio_has_changed = False
      for bar_entry in bar.bar:
          parsed_value = value.determine(bar_entry[1])
          ratio = parsed_value[2:]
          if ratio == latest_ratio:
              result += from_NoteContainer(bar_entry[2], bar_entry[1],
                      standalone=False) + ' '
          else:
              if ratio_has_changed:
                  result += '}'
              result += '\\times %d/%d {' % (ratio[1], ratio[0])
              result += from_NoteContainer(bar_entry[2], bar_entry[1],
                      standalone=False) + ' '
              latest_ratio = ratio
              ratio_has_changed = True
      if ratio_has_changed:
          result += '}'
  
      # Process the time
      if showtime:
          return '{ \\time %d/%d %s}' % (bar.meter[0], bar.meter[1], result)
      else:
          return '{ %s}' % result
docs: Get a Bar object and return the LilyPond equivalent in a string.
  
      The showkey and showtime parameters can be set to determine whether the
      key and the time should be shown.