'Validate input.'

def _validate_input(self, items, captions, section, comments=None):

    if (not isinstance(items, (list, tuple))):
        items = [items]
    if (not isinstance(captions, (list, tuple))):
        captions = [captions]
    if (not isinstance(comments, (list, tuple))):
        if (comments is None):
            comments = ([comments] * len(captions))
        else:
            comments = [comments]
    if (len(comments) != len(items)):
        raise ValueError('Comments    and    report    items    must    have    the    same    length    or    comments    should    be    None.')
    elif (len(captions) != len(items)):
        raise ValueError('Captions    and    report    items    must    have    the    same    length.')
    if (section not in self.sections):
        self.sections.append(section)
        self._sectionvars[section] = _clean_varnames(section)
    return (items, captions, comments)
