<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def document( self, file, title=None, *, description=None, type=None, mime_type=None, attributes=None, force_document=False, voice_note=False, video_note=False, use_cache=True, id=None, text=None, parse_mode=(), link_preview=True, geo=None, period=60, contact=None, game=False, buttons=None ):
 """ Creates a new inline result of document type. `use_cache`, `mime_type`, `attributes`, `force_document`, `voice_note` and `video_note` are described in `client.send_file <telethon.client.uploads.UploadMethods.send_file>`. Args: file (`obj`):
 Same as ``file`` for `client.send_file <telethon.client.uploads.UploadMethods.send_file>`. title (`str`, optional):
 The title to be shown for this result. description (`str`, optional):
 Further explanation of what this result means. type (`str`, optional):
 The type of the document. May be one of: photo, gif, mpeg4_gif, video, audio, voice, document, sticker. See "Type of the result" in https://core.telegram.org/bots/api. """

        if type is None:
            if voice_note:
                type = 'voice'
            else:
                type = 'document'

        try:
            fh = utils.get_input_document(file)
        except TypeError:
            use_cache = types.InputDocument if use_cache else None
            fh = await self._client.upload_file(file, use_cache=use_cache)

        if not isinstance(fh, types.InputDocument):
            attributes, mime_type = utils.get_attributes(
                file,
                mime_type=mime_type,
                attributes=attributes,
                force_document=force_document,
                voice_note=voice_note,
                video_note=video_note
            )
            r = await self._client(functions.messages.UploadMediaRequest(
                types.InputPeerSelf(), media=types.InputMediaUploadedDocument(
                    fh,
                    mime_type=mime_type,
                    attributes=attributes,
                    nosound_video=None,
                    thumb=None
            )))
            fh = utils.get_input_document(r.document)

        result = types.InputBotInlineResultDocument(
            id=id or '',
            type=type,
            document=fh,
            send_message=await self._message(
                # Empty string for text if there's media but text is None.
                # We may want to display a document but send text; however
                # default to sending the media (without text, i.e. stickers).
                text=text or '',
                parse_mode=parse_mode,
                link_preview=link_preview,
                geo=geo,
                period=period,
                contact=contact,
                game=game,
                buttons=buttons
            ),
            title=title,
            description=description
        )
        if id is None:
            result.id = hashlib.sha256(bytes(result)).hexdigest()

        return result