def from_text(rdclass, rdtype, tok, origin=None, relativize=True):
    'Build an rdata object from text format.\n\n    This function attempts to dynamically load a class which\n    implements the specified rdata class and type.  If there is no\n    class-and-type-specific implementation, the GenericRdata class\n    is used.\n\n    Once a class is chosen, its from_text() class method is called\n    with the parameters to this function.\n\n    If I{tok} is a string, then a tokenizer is created and the string\n    is used as its input.\n\n    @param rdclass: The rdata class\n    @type rdclass: int\n    @param rdtype: The rdata type\n    @type rdtype: int\n    @param tok: The tokenizer or input text\n    @type tok: dns.tokenizer.Tokenizer or string\n    @param origin: The origin to use for relative names\n    @type origin: dns.name.Name\n    @param relativize: Should names be relativized?\n    @type relativize: bool\n    @rtype: dns.rdata.Rdata instance'
    if isinstance(tok, string_types):
        tok = dns.tokenizer.Tokenizer(tok)
    cls = get_rdata_class(rdclass, rdtype)
    if (cls != GenericRdata):
        token = tok.get()
        tok.unget(token)
        if (token.is_identifier() and (token.value == '\\#')):
            rdata = GenericRdata.from_text(rdclass, rdtype, tok, origin, relativize)
            return from_wire(rdclass, rdtype, rdata.data, 0, len(rdata.data), origin)
    return cls.from_text(rdclass, rdtype, tok, origin, relativize)
Build an rdata object from text format.

This function attempts to dynamically load a class which
implements the specified rdata class and type.  If there is no
class-and-type-specific implementation, the GenericRdata class
is used.

Once a class is chosen, its from_text() class method is called
with the parameters to this function.

If I{tok} is a string, then a tokenizer is created and the string
is used as its input.

@param rdclass: The rdata class
@type rdclass: int
@param rdtype: The rdata type
@type rdtype: int
@param tok: The tokenizer or input text
@type tok: dns.tokenizer.Tokenizer or string
@param origin: The origin to use for relative names
@type origin: dns.name.Name
@param relativize: Should names be relativized?
@type relativize: bool
@rtype: dns.rdata.Rdata instance
def from_text(rdclass, rdtype, tok, origin=None, relativize=True):
    'Build an rdata object from text format.\n\n    This function attempts to dynamically load a class which\n    implements the specified rdata class and type.  If there is no\n    class-and-type-specific implementation, the GenericRdata class\n    is used.\n\n    Once a class is chosen, its from_text() class method is called\n    with the parameters to this function.\n\n    If I{tok} is a string, then a tokenizer is created and the string\n    is used as its input.\n\n    @param rdclass: The rdata class\n    @type rdclass: int\n    @param rdtype: The rdata type\n    @type rdtype: int\n    @param tok: The tokenizer or input text\n    @type tok: dns.tokenizer.Tokenizer or string\n    @param origin: The origin to use for relative names\n    @type origin: dns.name.Name\n    @param relativize: Should names be relativized?\n    @type relativize: bool\n    @rtype: dns.rdata.Rdata instance'
    if isinstance(tok, string_types):
        tok = dns.tokenizer.Tokenizer(tok)
    cls = get_rdata_class(rdclass, rdtype)
    if (cls != GenericRdata):
        token = tok.get()
        tok.unget(token)
        if (token.is_identifier() and (token.value == '\\#')):
            rdata = GenericRdata.from_text(rdclass, rdtype, tok, origin, relativize)
            return from_wire(rdclass, rdtype, rdata.data, 0, len(rdata.data), origin)
    return cls.from_text(rdclass, rdtype, tok, origin, relativize)