def get(self, media, dirpath=None, filename=None, overwrite=False, b64decode=False):
import os<EOL>data = self._dokuwiki.send('<STR_LIT>', media)<EOL>data = base64.b64decode(data) if b64decode else data.data<EOL>if dirpath is None:<EOL><INDENT>return data<EOL><DEDENT>if filename is None:<EOL><INDENT>filename = media.replace('<STR_LIT:/>', '<STR_LIT::>').split('<STR_LIT::>')[-<NUM_LIT:1>]<EOL><DEDENT>if not os.path.exists(dirpath):<EOL><INDENT>os.makedirs(dirpath)<EOL><DEDENT>filepath = os.path.join(dirpath, filename)<EOL>if os.path.exists(filepath) and not overwrite:<EOL><INDENT>raise FileExistsError("<STR_LIT>" % filepath)<EOL><DEDENT>with open(filepath, '<STR_LIT:wb>') as fhandler:<EOL><INDENT>fhandler.write(data)<EOL><DEDENT>
Returns the binary data of *media* or save it to a file. If *dirpath*
        is not set the binary data is returned, otherwise the data is saved
        to a file. By default, the filename is the name of the media but it can
        be changed with *filename* parameter. *overwrite* parameter allow to
        overwrite the file if it already exists locally.