'Returns a (type, Vector)-tuple for the given document.
If the document is part of a LSA-reduced model, returns the LSA concept vector.
If the given type is None, returns document.type (if a Document is given).'

def _vector(self, document, type=None, **kwargs):

    if isinstance(document, Document):
        if (type is None):
            type = document.type
        if (document.model and document.model.lsa):
            return (type, document.model.lsa[document.id])
        return (type, document.vector)
    if isinstance(document, Vector):
        return (type, document)
    if isinstance(document, dict):
        return (type, Vector(document, **kwargs))
    if isinstance(document, (list, tuple)):
        return (type, Document(document, filter=None, stopwords=True).vector)
    if isinstance(document, basestring):
        return (type, Document(document, filter=None, stopwords=True).vector)
