def stripextras(value):
     from StarFile import remove_line_folding, remove_line_prefix
     # we get rid of semicolons and leading/trailing terminators etc.
     import re
     jj = re.compile("[\n\r\f \t\v]*")
     semis = re.compile("[\n\r\f \t\v]*[\n\r\f]\n*;")
     cut = semis.match(value)
     if cut:        #we have a semicolon-delimited string
          nv = value[cut.end():len(value)-2]
          try:
             if nv[-1]=='\r': nv = nv[:-1]
          except IndexError:    #empty data value
             pass
          # apply protocols
          nv = remove_line_prefix(nv)
          nv = remove_line_folding(nv)
          return nv 
     else: 
          cut = jj.match(value)
          if cut:
               return stripstring(value[cut.end():])
          return value
def stripextras(value):
    from StarFile import remove_line_folding, remove_line_prefix
    # we get rid of semicolons and leading/trailing terminators etc.
    import re
    jj = re.compile("[\n\r\f \t\v]*")
    semis = re.compile("[\n\r\f \t\v]*[\n\r\f]\n*;")
    cut = semis.match(value)
    if cut:  #we have a semicolon-delimited string
        nv = value[cut.end():len(value) - 2]
        try:
            if nv[-1] == '\r': nv = nv[:-1]
        except IndexError:  #empty data value
            pass
        # apply protocols
        nv = remove_line_prefix(nv)
        nv = remove_line_folding(nv)
        return nv
    else:
        cut = jj.match(value)
        if cut:
            return stripstring(value[cut.end():])
        return value