def connect(mask):
    """ Find if a mask is singly or multiply connected """
    import scipy.ndimage as nd
    connectivity = nd.generate_binary_structure(2, 2)
    labels, count = nd.label(mask, connectivity)
    if count > 1:
        connected = 'multiple'
    else:
        connected = 'single'
    return connected, count
