'Get the lengths of colorbar extensions.
A helper method for _uniform_y and _proportional_y.'

def _get_extension_lengths(self, frac, automin, automax, default=0.05):

    extendlength = np.array([default, default])
    if isinstance(frac, six.string_types):
        if (frac.lower() == u'auto'):
            extendlength[0] = automin
            extendlength[1] = automax
        else:
            raise ValueError(u'invalid    value    for    extendfrac')
    elif (frac is not None):
        try:
            extendlength[:] = frac
            if np.isnan(extendlength).any():
                raise ValueError()
        except (TypeError, ValueError):
            raise ValueError(u'invalid    value    for    extendfrac')
    return extendlength
