code: def _record2card(self, record):
          
          name = record['name']
          value = record['value']
  
          v_isstring = isstring(value)
  
          if name == 'COMMENT':
              # card = 'COMMENT   %s' % value
              card = 'COMMENT %s' % value
          elif name == 'CONTINUE':
              card = 'CONTINUE   %s' % value
          elif name == 'HISTORY':
              card = 'HISTORY   %s' % value
          else:
              if len(name) > 8:
                  card = 'HIERARCH %s= ' % name
              else:
                  card = '%-8s= ' % name[0:8]
  
              # these may be string representations of data, or actual strings
              if v_isstring:
                  value = str(value)
                  if len(value) > 0:
                      if value[0] != "'":
                          # this is a string representing a string header field
                          # make it look like it will look in the header
                          value = "'" + value + "'"
                          vstr = '%-20s' % value
                      else:
                          vstr = "%20s" % value
                  else:
                      vstr = "''"
              else:
                  vstr = '%20s' % value
  
              card += vstr
  
              if 'comment' in record:
                  card += ' / %s' % record['comment']
  
          if v_isstring and len(card) > 80:
              card = card[0:79] + "'"
          else:
              card = card[0:80]
  
          return card
docs: when we add new records they don't have a card,
          this sort of fakes it up similar to what cfitsio
          does, just for display purposes.  e.g.
  
              DBL     =            23.299843
              LNG     =              3423432
              KEYSNC  = 'hello   '
              KEYSC   = 'hello   '           / a comment for string
              KEYDC   =     3.14159265358979 / a comment for pi
              KEYLC   =            323423432 / a comment for long
  
          basically,
              - 8 chars, left aligned, for the keyword name
              - a space
              - 20 chars for value, left aligned for strings, right aligned for
                numbers
              - if there is a comment, one space followed by / then another space
                then the comment out to 80 chars