def get_block(blockidx, blocksz, obj):
    """
    Given obj, a list, return the intersection of
    obj[blockidx*blocksz:(blockidx+1)*blocksz] and obj

    Ex: get_block(2, 100, range(250) returns [200, 201, ..., 249]
    """
    if blockidx*blocksz > len(obj):
        return []
    elif (blockidx+1)*blocksz > len(obj):
        return obj[blockidx*blocksz:]
    else:
        return obj[blockidx*blocksz:(blockidx+1)*blocksz]