'Initializer.
Args:
doc_id: The visible printable ASCII string identifying the document which
does not start with \'!\'. Whitespace is excluded from ids. If no id is
provided, the search service will provide one.
fields: An iterable of Field instances representing the content of the
document.
language: The code of the language used in the field values.
rank: The rank of this document used to specify the order in which
documents are returned by search. Rank must be a non-negative integer.
If not specified, the number of seconds since 1st Jan 2011 is used.
Documents are returned in descending order of their rank, in absence
of sorting or scoring options.
facets: An iterable of Facet instances representing the facets for this
document.
Raises:
TypeError: If any of the parameters have invalid types, or an unknown
attribute is passed.
ValueError: If any of the parameters have invalid values.'

def __init__(self, doc_id=None, fields=None, language='en', rank=None, facets=None):

    doc_id = _ConvertToUnicode(doc_id)
    if (doc_id is not None):
        _CheckDocumentId(doc_id)
    self._doc_id = doc_id
    self._fields = _GetList(fields)
    self._facets = _GetList(facets)
    self._language = _CheckLanguage(_ConvertToUnicode(language))
    self._field_map = None
    self._facet_map = None
    doc_rank = rank
    if (doc_rank is None):
        doc_rank = self._GetDefaultRank()
    self._rank = self._CheckRank(doc_rank)
    _CheckDocument(self)
