Generator function to create lob from payload.
    Depending on lob type a BLOB, CLOB, or NCLOB instance will be returned.
    This function is usually called from types.*LobType.from_resultset()

def from_payload(type_code, payload, connection):
    """Generator function to create lob from payload.
    Depending on lob type a BLOB, CLOB, or NCLOB instance will be returned.
    This function is usually called from types.*LobType.from_resultset()
    """
    lob_header = ReadLobHeader(payload)
    if lob_header.isnull():
        lob = None
    else:
        data = payload.read(lob_header.chunk_length)
        _LobClass = LOB_TYPE_CODE_MAP[type_code]
        lob = _LobClass.from_payload(data, lob_header, connection)
        logger.debug('Lob Header %r' % lob)
    return lob