def METHOD_NAME(s, keep=False, maxsplit=None):
    """Split a string on whitespace, optionally keeping the whitespace.
    Args:
        s: The string to split.
        keep: Whether to keep whitespace.
        maxsplit: The maximum count of splits.
    Return:
        A list of split strings.
    """
    whitespace = '\n\t '
    if maxsplit == 0:
        # re.split with maxsplit=0 splits everything, while str.split splits
        # nothing (which is the behavior we want).
        if keep:
            return [s]
        else:
            return [s.strip(whitespace)]
    elif maxsplit is None:
        maxsplit = 0
    if keep:
        pattern = '([' + whitespace + '])'
        parts = re.split(pattern, s, maxsplit=maxsplit)
        return _combine_ws(parts, whitespace)
    else:
        pattern = '[' + whitespace + ']'
        parts = re.split(pattern, s, maxsplit=maxsplit)
        parts[-1] = parts[-1].rstrip()
        return [p for p in parts if p]