def _get_length(topic, expected):
    length = None
    try:
        length = len(topic)
    except (__HOLE__, TypeError):
        if hasattr(topic, 'qsize'):
            length = topic.qsize()
    if length is None:
        msg = "Could not determine \"{0}\"'s length.".format(topic)
        raise AssertionError(msg)
    return length


#-------------------------------------------------------------------------------------------------
# Assertions
#-------------------------------------------------------------------------------------------------
dataset/ETHPy150Open heynemann/preggy/preggy/assertions/length.py/_get_length