'Return the filename for the document name.
If *base* is True, return absolute path under self.srcdir.
If *base* is None, return relative path to self.srcdir.
If *base* is a path string, return absolute path under that.
If *suffix* is not None, add it instead of config.source_suffix.'

def doc2path(self, docname, base=True, suffix=None):

    docname = docname.replace(SEP, path.sep)
    if (suffix is None):
        candidate_suffix = None
        for candidate_suffix in self.config.source_suffix:
            if path.isfile((path.join(self.srcdir, docname) + candidate_suffix)):
                suffix = candidate_suffix
                break
        else:
            suffix = self.config.source_suffix[0]
    if (base is True):
        return (path.join(self.srcdir, docname) + suffix)
    elif (base is None):
        return (docname + suffix)
    else:
        return (path.join(base, docname) + suffix)
