We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] Cannot Download a File if it doesnt have a `file_path` or if `custom_path` is not provided to `download()`
<!--
Thanks for reporting issues of python-telegram-bot!

Use this template to notify us if you found a bug.

To make it easier for us to help you please enter detailed information below.

Please note, we only support the latest version of python-telegram-bot and
master branch. Please make sure to upgrade & recreate the issue on the latest
version prior to opening an issue.
-->
### Steps to reproduce
1. Create an operation with the above mentioned aspects

Ex:
```
def run_bot(token):
    def make_pasta(update, context):
        msg = update.message

        if msg.reply_to_message is None:
            msg.reply_text(responses.NOT_A_REPLY)
            return
        if msg.reply_to_message.document is None:
            msg.reply_text(responses.NOT_A_DOC)
            return
        telegram_file = File(msg.reply_to_message.document.file_id)
        telegram_file.download() 

    updater = Updater(token, use_context=True)
    dp = updater.dispatcher

    dp.add_handler(CommandHandler('hello', hello))
    dp.add_handler(CommandHandler('make_pasta', make_pasta))

    print('Log: Seu bot iniciou! (:')
    updater.start_polling()
    updater.idle() 
```
(I know this is not exactly a MWE, sorry)

### Expected behaviour
According to the documentation, it should download the file directly to my current working directory `Download this file. By default, the file is saved in the current working directory with its original filename as reported by Telegram.`

### Actual behaviour
on `telegram/files/file.py`, on the download function, we get a type error since `self.file_path` is NoneType, not str or os.PathLike object

### Configuration
Ubuntu 18.04

python-telegram-bot 12.2.0
certifi 2019.09.11
future 0.18.1
Python 3.7.3 (default, Apr  3 2019, 19:16:38)  [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `telegram/files/file.py`
Content:
```
1 #!/usr/bin/env python
2 #
3 # A library that provides a Python interface to the Telegram Bot API
4 # Copyright (C) 2015-2018
5 # Leandro Toledo de Souza <devs@python-telegram-bot.org>
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU Lesser Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser Public License
18 # along with this program.  If not, see [http://www.gnu.org/licenses/].
19 """This module contains an object that represents a Telegram File."""
20 from base64 import b64decode
21 from os.path import basename
22 
23 from future.backports.urllib import parse as urllib_parse
24 
25 from telegram import TelegramObject
26 from telegram.passport.credentials import decrypt
27 
28 
29 class File(TelegramObject):
30     """
31     This object represents a file ready to be downloaded. The file can be downloaded with
32     :attr:`download`. It is guaranteed that the link will be valid for at least 1 hour. When the
33     link expires, a new one can be requested by calling getFile.
34 
35     Note:
36         Maximum file size to download is 20 MB
37 
38     Attributes:
39         file_id (:obj:`str`): Unique identifier for this file.
40         file_size (:obj:`str`): Optional. File size.
41         file_path (:obj:`str`): Optional. File path. Use :attr:`download` to get the file.
42 
43     Args:
44         file_id (:obj:`str`): Unique identifier for this file.
45         file_size (:obj:`int`, optional): Optional. File size, if known.
46         file_path (:obj:`str`, optional): File path. Use :attr:`download` to get the file.
47         bot (:obj:`telegram.Bot`, optional): Bot to use with shortcut method.
48         **kwargs (:obj:`dict`): Arbitrary keyword arguments.
49 
50     Note:
51         If you obtain an instance of this class from :attr:`telegram.PassportFile.get_file`,
52         then it will automatically be decrypted as it downloads when you call :attr:`download()`.
53 
54     """
55 
56     def __init__(self, file_id, bot=None, file_size=None, file_path=None, **kwargs):
57         # Required
58         self.file_id = str(file_id)
59 
60         # Optionals
61         self.file_size = file_size
62         self.file_path = file_path
63 
64         self.bot = bot
65         self._credentials = None
66 
67         self._id_attrs = (self.file_id,)
68 
69     @classmethod
70     def de_json(cls, data, bot):
71         if not data:
72             return None
73 
74         return cls(bot=bot, **data)
75 
76     def download(self, custom_path=None, out=None, timeout=None):
77         """
78         Download this file. By default, the file is saved in the current working directory with its
79         original filename as reported by Telegram. If a :attr:`custom_path` is supplied, it will be
80         saved to that path instead. If :attr:`out` is defined, the file contents will be saved to
81         that object using the ``out.write`` method.
82 
83         Note:
84             :attr:`custom_path` and :attr:`out` are mutually exclusive.
85 
86         Args:
87             custom_path (:obj:`str`, optional): Custom path.
88             out (:obj:`io.BufferedWriter`, optional): A file-like object. Must be opened for
89                 writing in binary mode, if applicable.
90             timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
91                 the read timeout from the server (instead of the one specified during creation of
92                 the connection pool).
93 
94         Returns:
95             :obj:`str` | :obj:`io.BufferedWriter`: The same object as :attr:`out` if specified.
96             Otherwise, returns the filename downloaded to.
97 
98         Raises:
99             ValueError: If both :attr:`custom_path` and :attr:`out` are passed.
100 
101         """
102         if custom_path is not None and out is not None:
103             raise ValueError('custom_path and out are mutually exclusive')
104 
105         # Convert any UTF-8 char into a url encoded ASCII string.
106         url = self._get_encoded_url()
107 
108         if out:
109             buf = self.bot.request.retrieve(url)
110             if self._credentials:
111                 buf = decrypt(b64decode(self._credentials.secret),
112                               b64decode(self._credentials.hash),
113                               buf)
114             out.write(buf)
115             return out
116         else:
117             if custom_path:
118                 filename = custom_path
119             else:
120                 filename = basename(self.file_path)
121 
122             buf = self.bot.request.retrieve(url, timeout=timeout)
123             if self._credentials:
124                 buf = decrypt(b64decode(self._credentials.secret),
125                               b64decode(self._credentials.hash),
126                               buf)
127             with open(filename, 'wb') as fobj:
128                 fobj.write(buf)
129             return filename
130 
131     def _get_encoded_url(self):
132         """Convert any UTF-8 char in :obj:`File.file_path` into a url encoded ASCII string."""
133         sres = urllib_parse.urlsplit(self.file_path)
134         return urllib_parse.urlunsplit(urllib_parse.SplitResult(
135             sres.scheme, sres.netloc, urllib_parse.quote(sres.path), sres.query, sres.fragment))
136 
137     def download_as_bytearray(self, buf=None):
138         """Download this file and return it as a bytearray.
139 
140         Args:
141             buf (:obj:`bytearray`, optional): Extend the given bytearray with the downloaded data.
142 
143         Returns:
144             :obj:`bytearray`: The same object as :attr:`buf` if it was specified. Otherwise a newly
145             allocated :obj:`bytearray`.
146 
147         """
148         if buf is None:
149             buf = bytearray()
150 
151         buf.extend(self.bot.request.retrieve(self._get_encoded_url()))
152         return buf
153 
154     def set_credentials(self, credentials):
155         self._credentials = credentials
156
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/telegram/files/file.py b/telegram/files/file.py
--- a/telegram/files/file.py
+++ b/telegram/files/file.py
@@ -19,6 +19,7 @@
 """This module contains an object that represents a Telegram File."""
 from base64 import b64decode
 from os.path import basename
+import os
 
 from future.backports.urllib import parse as urllib_parse
 
@@ -76,9 +77,10 @@
     def download(self, custom_path=None, out=None, timeout=None):
         """
         Download this file. By default, the file is saved in the current working directory with its
-        original filename as reported by Telegram. If a :attr:`custom_path` is supplied, it will be
-        saved to that path instead. If :attr:`out` is defined, the file contents will be saved to
-        that object using the ``out.write`` method.
+        original filename as reported by Telegram. If the file has no filename, it the file ID will
+        be used as filename. If a :attr:`custom_path` is supplied, it will be saved to that path
+        instead. If :attr:`out` is defined, the file contents will be saved to that object using
+        the ``out.write`` method.
 
         Note:
             :attr:`custom_path` and :attr:`out` are mutually exclusive.
@@ -116,8 +118,10 @@
         else:
             if custom_path:
                 filename = custom_path
-            else:
+            elif self.file_path:
                 filename = basename(self.file_path)
+            else:
+                filename = os.path.join(os.getcwd(), self.file_id)
 
             buf = self.bot.request.retrieve(url, timeout=timeout)
             if self._credentials:

{"golden_diff": "diff --git a/telegram/files/file.py b/telegram/files/file.py\n--- a/telegram/files/file.py\n+++ b/telegram/files/file.py\n@@ -19,6 +19,7 @@\n \"\"\"This module contains an object that represents a Telegram File.\"\"\"\n from base64 import b64decode\n from os.path import basename\n+import os\n \n from future.backports.urllib import parse as urllib_parse\n \n@@ -76,9 +77,10 @@\n     def download(self, custom_path=None, out=None, timeout=None):\n         \"\"\"\n         Download this file. By default, the file is saved in the current working directory with its\n-        original filename as reported by Telegram. If a :attr:`custom_path` is supplied, it will be\n-        saved to that path instead. If :attr:`out` is defined, the file contents will be saved to\n-        that object using the ``out.write`` method.\n+        original filename as reported by Telegram. If the file has no filename, it the file ID will\n+        be used as filename. If a :attr:`custom_path` is supplied, it will be saved to that path\n+        instead. If :attr:`out` is defined, the file contents will be saved to that object using\n+        the ``out.write`` method.\n \n         Note:\n             :attr:`custom_path` and :attr:`out` are mutually exclusive.\n@@ -116,8 +118,10 @@\n         else:\n             if custom_path:\n                 filename = custom_path\n-            else:\n+            elif self.file_path:\n                 filename = basename(self.file_path)\n+            else:\n+                filename = os.path.join(os.getcwd(), self.file_id)\n \n             buf = self.bot.request.retrieve(url, timeout=timeout)\n             if self._credentials:\n", "issue": "[BUG] Cannot Download a File if it doesnt have a `file_path` or if `custom_path` is not provided to `download()`\n<!--\r\nThanks for reporting issues of python-telegram-bot!\r\n\r\nUse this template to notify us if you found a bug.\r\n\r\nTo make it easier for us to help you please enter detailed information below.\r\n\r\nPlease note, we only support the latest version of python-telegram-bot and\r\nmaster branch. Please make sure to upgrade & recreate the issue on the latest\r\nversion prior to opening an issue.\r\n-->\r\n### Steps to reproduce\r\n1. Create an operation with the above mentioned aspects\r\n\r\nEx:\r\n```\r\ndef run_bot(token):\r\n    def make_pasta(update, context):\r\n        msg = update.message\r\n\r\n        if msg.reply_to_message is None:\r\n            msg.reply_text(responses.NOT_A_REPLY)\r\n            return\r\n        if msg.reply_to_message.document is None:\r\n            msg.reply_text(responses.NOT_A_DOC)\r\n            return\r\n        telegram_file = File(msg.reply_to_message.document.file_id)\r\n        telegram_file.download() \r\n\r\n    updater = Updater(token, use_context=True)\r\n    dp = updater.dispatcher\r\n\r\n    dp.add_handler(CommandHandler('hello', hello))\r\n    dp.add_handler(CommandHandler('make_pasta', make_pasta))\r\n\r\n    print('Log: Seu bot iniciou! (:')\r\n    updater.start_polling()\r\n    updater.idle() \r\n```\r\n(I know this is not exactly a MWE, sorry)\r\n\r\n### Expected behaviour\r\nAccording to the documentation, it should download the file directly to my current working directory `Download this file. By default, the file is saved in the current working directory with its original filename as reported by Telegram.`\r\n\r\n### Actual behaviour\r\non `telegram/files/file.py`, on the download function, we get a type error since `self.file_path` is NoneType, not str or os.PathLike object\r\n\r\n### Configuration\r\nUbuntu 18.04\r\n\r\npython-telegram-bot 12.2.0\r\ncertifi 2019.09.11\r\nfuture 0.18.1\r\nPython 3.7.3 (default, Apr  3 2019, 19:16:38)  [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]\n", "before_files": [{"content": "#!/usr/bin/env python\n#\n# A library that provides a Python interface to the Telegram Bot API\n# Copyright (C) 2015-2018\n# Leandro Toledo de Souza <devs@python-telegram-bot.org>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Lesser Public License for more details.\n#\n# You should have received a copy of the GNU Lesser Public License\n# along with this program.  If not, see [http://www.gnu.org/licenses/].\n\"\"\"This module contains an object that represents a Telegram File.\"\"\"\nfrom base64 import b64decode\nfrom os.path import basename\n\nfrom future.backports.urllib import parse as urllib_parse\n\nfrom telegram import TelegramObject\nfrom telegram.passport.credentials import decrypt\n\n\nclass File(TelegramObject):\n    \"\"\"\n    This object represents a file ready to be downloaded. The file can be downloaded with\n    :attr:`download`. It is guaranteed that the link will be valid for at least 1 hour. When the\n    link expires, a new one can be requested by calling getFile.\n\n    Note:\n        Maximum file size to download is 20 MB\n\n    Attributes:\n        file_id (:obj:`str`): Unique identifier for this file.\n        file_size (:obj:`str`): Optional. File size.\n        file_path (:obj:`str`): Optional. File path. Use :attr:`download` to get the file.\n\n    Args:\n        file_id (:obj:`str`): Unique identifier for this file.\n        file_size (:obj:`int`, optional): Optional. File size, if known.\n        file_path (:obj:`str`, optional): File path. Use :attr:`download` to get the file.\n        bot (:obj:`telegram.Bot`, optional): Bot to use with shortcut method.\n        **kwargs (:obj:`dict`): Arbitrary keyword arguments.\n\n    Note:\n        If you obtain an instance of this class from :attr:`telegram.PassportFile.get_file`,\n        then it will automatically be decrypted as it downloads when you call :attr:`download()`.\n\n    \"\"\"\n\n    def __init__(self, file_id, bot=None, file_size=None, file_path=None, **kwargs):\n        # Required\n        self.file_id = str(file_id)\n\n        # Optionals\n        self.file_size = file_size\n        self.file_path = file_path\n\n        self.bot = bot\n        self._credentials = None\n\n        self._id_attrs = (self.file_id,)\n\n    @classmethod\n    def de_json(cls, data, bot):\n        if not data:\n            return None\n\n        return cls(bot=bot, **data)\n\n    def download(self, custom_path=None, out=None, timeout=None):\n        \"\"\"\n        Download this file. By default, the file is saved in the current working directory with its\n        original filename as reported by Telegram. If a :attr:`custom_path` is supplied, it will be\n        saved to that path instead. If :attr:`out` is defined, the file contents will be saved to\n        that object using the ``out.write`` method.\n\n        Note:\n            :attr:`custom_path` and :attr:`out` are mutually exclusive.\n\n        Args:\n            custom_path (:obj:`str`, optional): Custom path.\n            out (:obj:`io.BufferedWriter`, optional): A file-like object. Must be opened for\n                writing in binary mode, if applicable.\n            timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as\n                the read timeout from the server (instead of the one specified during creation of\n                the connection pool).\n\n        Returns:\n            :obj:`str` | :obj:`io.BufferedWriter`: The same object as :attr:`out` if specified.\n            Otherwise, returns the filename downloaded to.\n\n        Raises:\n            ValueError: If both :attr:`custom_path` and :attr:`out` are passed.\n\n        \"\"\"\n        if custom_path is not None and out is not None:\n            raise ValueError('custom_path and out are mutually exclusive')\n\n        # Convert any UTF-8 char into a url encoded ASCII string.\n        url = self._get_encoded_url()\n\n        if out:\n            buf = self.bot.request.retrieve(url)\n            if self._credentials:\n                buf = decrypt(b64decode(self._credentials.secret),\n                              b64decode(self._credentials.hash),\n                              buf)\n            out.write(buf)\n            return out\n        else:\n            if custom_path:\n                filename = custom_path\n            else:\n                filename = basename(self.file_path)\n\n            buf = self.bot.request.retrieve(url, timeout=timeout)\n            if self._credentials:\n                buf = decrypt(b64decode(self._credentials.secret),\n                              b64decode(self._credentials.hash),\n                              buf)\n            with open(filename, 'wb') as fobj:\n                fobj.write(buf)\n            return filename\n\n    def _get_encoded_url(self):\n        \"\"\"Convert any UTF-8 char in :obj:`File.file_path` into a url encoded ASCII string.\"\"\"\n        sres = urllib_parse.urlsplit(self.file_path)\n        return urllib_parse.urlunsplit(urllib_parse.SplitResult(\n            sres.scheme, sres.netloc, urllib_parse.quote(sres.path), sres.query, sres.fragment))\n\n    def download_as_bytearray(self, buf=None):\n        \"\"\"Download this file and return it as a bytearray.\n\n        Args:\n            buf (:obj:`bytearray`, optional): Extend the given bytearray with the downloaded data.\n\n        Returns:\n            :obj:`bytearray`: The same object as :attr:`buf` if it was specified. Otherwise a newly\n            allocated :obj:`bytearray`.\n\n        \"\"\"\n        if buf is None:\n            buf = bytearray()\n\n        buf.extend(self.bot.request.retrieve(self._get_encoded_url()))\n        return buf\n\n    def set_credentials(self, credentials):\n        self._credentials = credentials\n", "path": "telegram/files/file.py"}], "after_files": [{"content": "#!/usr/bin/env python\n#\n# A library that provides a Python interface to the Telegram Bot API\n# Copyright (C) 2015-2018\n# Leandro Toledo de Souza <devs@python-telegram-bot.org>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Lesser Public License for more details.\n#\n# You should have received a copy of the GNU Lesser Public License\n# along with this program.  If not, see [http://www.gnu.org/licenses/].\n\"\"\"This module contains an object that represents a Telegram File.\"\"\"\nfrom base64 import b64decode\nfrom os.path import basename\nimport os\n\nfrom future.backports.urllib import parse as urllib_parse\n\nfrom telegram import TelegramObject\nfrom telegram.passport.credentials import decrypt\n\n\nclass File(TelegramObject):\n    \"\"\"\n    This object represents a file ready to be downloaded. The file can be downloaded with\n    :attr:`download`. It is guaranteed that the link will be valid for at least 1 hour. When the\n    link expires, a new one can be requested by calling getFile.\n\n    Note:\n        Maximum file size to download is 20 MB\n\n    Attributes:\n        file_id (:obj:`str`): Unique identifier for this file.\n        file_size (:obj:`str`): Optional. File size.\n        file_path (:obj:`str`): Optional. File path. Use :attr:`download` to get the file.\n\n    Args:\n        file_id (:obj:`str`): Unique identifier for this file.\n        file_size (:obj:`int`, optional): Optional. File size, if known.\n        file_path (:obj:`str`, optional): File path. Use :attr:`download` to get the file.\n        bot (:obj:`telegram.Bot`, optional): Bot to use with shortcut method.\n        **kwargs (:obj:`dict`): Arbitrary keyword arguments.\n\n    Note:\n        If you obtain an instance of this class from :attr:`telegram.PassportFile.get_file`,\n        then it will automatically be decrypted as it downloads when you call :attr:`download()`.\n\n    \"\"\"\n\n    def __init__(self, file_id, bot=None, file_size=None, file_path=None, **kwargs):\n        # Required\n        self.file_id = str(file_id)\n\n        # Optionals\n        self.file_size = file_size\n        self.file_path = file_path\n\n        self.bot = bot\n        self._credentials = None\n\n        self._id_attrs = (self.file_id,)\n\n    @classmethod\n    def de_json(cls, data, bot):\n        if not data:\n            return None\n\n        return cls(bot=bot, **data)\n\n    def download(self, custom_path=None, out=None, timeout=None):\n        \"\"\"\n        Download this file. By default, the file is saved in the current working directory with its\n        original filename as reported by Telegram. If the file has no filename, it the file ID will\n        be used as filename. If a :attr:`custom_path` is supplied, it will be saved to that path\n        instead. If :attr:`out` is defined, the file contents will be saved to that object using\n        the ``out.write`` method.\n\n        Note:\n            :attr:`custom_path` and :attr:`out` are mutually exclusive.\n\n        Args:\n            custom_path (:obj:`str`, optional): Custom path.\n            out (:obj:`io.BufferedWriter`, optional): A file-like object. Must be opened for\n                writing in binary mode, if applicable.\n            timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as\n                the read timeout from the server (instead of the one specified during creation of\n                the connection pool).\n\n        Returns:\n            :obj:`str` | :obj:`io.BufferedWriter`: The same object as :attr:`out` if specified.\n            Otherwise, returns the filename downloaded to.\n\n        Raises:\n            ValueError: If both :attr:`custom_path` and :attr:`out` are passed.\n\n        \"\"\"\n        if custom_path is not None and out is not None:\n            raise ValueError('custom_path and out are mutually exclusive')\n\n        # Convert any UTF-8 char into a url encoded ASCII string.\n        url = self._get_encoded_url()\n\n        if out:\n            buf = self.bot.request.retrieve(url)\n            if self._credentials:\n                buf = decrypt(b64decode(self._credentials.secret),\n                              b64decode(self._credentials.hash),\n                              buf)\n            out.write(buf)\n            return out\n        else:\n            if custom_path:\n                filename = custom_path\n            elif self.file_path:\n                filename = basename(self.file_path)\n            else:\n                filename = os.path.join(os.getcwd(), self.file_id)\n\n            buf = self.bot.request.retrieve(url, timeout=timeout)\n            if self._credentials:\n                buf = decrypt(b64decode(self._credentials.secret),\n                              b64decode(self._credentials.hash),\n                              buf)\n            with open(filename, 'wb') as fobj:\n                fobj.write(buf)\n            return filename\n\n    def _get_encoded_url(self):\n        \"\"\"Convert any UTF-8 char in :obj:`File.file_path` into a url encoded ASCII string.\"\"\"\n        sres = urllib_parse.urlsplit(self.file_path)\n        return urllib_parse.urlunsplit(urllib_parse.SplitResult(\n            sres.scheme, sres.netloc, urllib_parse.quote(sres.path), sres.query, sres.fragment))\n\n    def download_as_bytearray(self, buf=None):\n        \"\"\"Download this file and return it as a bytearray.\n\n        Args:\n            buf (:obj:`bytearray`, optional): Extend the given bytearray with the downloaded data.\n\n        Returns:\n            :obj:`bytearray`: The same object as :attr:`buf` if it was specified. Otherwise a newly\n            allocated :obj:`bytearray`.\n\n        \"\"\"\n        if buf is None:\n            buf = bytearray()\n\n        buf.extend(self.bot.request.retrieve(self._get_encoded_url()))\n        return buf\n\n    def set_credentials(self, credentials):\n        self._credentials = credentials\n", "path": "telegram/files/file.py"}]}