def CreateLDIF(dn, record, base64_attrs=None, cols=76):
 f = StringIO()
 ldif_writer = LDIFWriter(f, base64_attrs, cols, '\n')
 ldif_writer.unparse(dn, record)
 s = f.getvalue()
 f.close()
 return s

def CreateLDIF ( dn , record , base64_attrs = None , cols = 76 ) : f = StringIO ( ) ldif_writer = LDIFWriter ( f , base64_attrs , cols , '\n' ) ldif_writer . unparse ( dn , record ) s = f . getvalue ( ) f . close ( ) return s
create ldif single formatted record including trailing empty line .