def _check_regularize(regularize):
    """Ensure regularize is valid."""
    if not (regularize is None or isinstance(regularize, str) and 
        regularize in ('in',)):
        raise ValueError('regularize must be None or "in"')
