@classmethod
def encode(cls, source, uni_type=type(u''), isinstance=isinstance):
    """ The encode() constructor is a legacy function that is
            also a convenience for the PdfWriter.
        """
    if isinstance(source, uni_type):
        return cls.from_unicode(source)
    else:
        return cls.from_bytes(source)
