def METHOD_NAME(self):
    try:
        # From array protocol
        array = self.context.__array_interface__
        n = array['shape'][0]
        assert n == 2 or n == 3
        return n
    except AttributeError:
        # Fall back on list
        return len(self.context)