'Helper that selects the appropriate fileids for a given set of
documents from a given subcorpus (pos or psd).'

def _getfileids(self, documents, subcorpus):

    if (documents is None):
        documents = self._documents
    else:
        if isinstance(documents, string_types):
            documents = [documents]
        for document in documents:
            if (document not in self._documents):
                if (document[(-4):] in ('.pos', '.psd')):
                    raise ValueError('Expected    a    document    identifier,    not    a    file    identifier.        (Use    corpus.documents()    to    get    a    list    of    document    identifiers.')
                else:
                    raise ValueError(('Document    identifier    %s    not    found' % document))
    return [('%s.%s' % (d, subcorpus)) for d in documents]
