@line_magic<EOL><INDENT>def bookmark(self, parameter_s='<STR_LIT>'):<DEDENT>
opts,args = self.parse_options(parameter_s,'<STR_LIT>',mode='<STR_LIT:list>')<EOL>if len(args) > <NUM_LIT:2>:<EOL><INDENT>raise UsageError("<STR_LIT>")<EOL><DEDENT>bkms = self.shell.db.get('<STR_LIT>',{})<EOL>if '<STR_LIT:d>' in opts:<EOL><INDENT>try:<EOL><INDENT>todel = args[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>raise UsageError(<EOL>"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>del bkms[todel]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise UsageError(<EOL>"<STR_LIT>" % todel)<EOL><DEDENT><DEDENT><DEDENT>elif '<STR_LIT:r>' in opts:<EOL><INDENT>bkms = {}<EOL><DEDENT>elif '<STR_LIT:l>' in opts:<EOL><INDENT>bks = list(bkms.keys())<EOL>bks.sort()<EOL>if bks:<EOL><INDENT>size = max(list(map(len, bks)))<EOL><DEDENT>else:<EOL><INDENT>size = <NUM_LIT:0><EOL><DEDENT>fmt = '<STR_LIT>'+str(size)+'<STR_LIT>'<EOL>print('<STR_LIT>')<EOL>for bk in bks:<EOL><INDENT>print(fmt % (bk, bkms[bk]))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not args:<EOL><INDENT>raise UsageError("<STR_LIT>")<EOL><DEDENT>elif len(args)==<NUM_LIT:1>:<EOL><INDENT>bkms[args[<NUM_LIT:0>]] = os.getcwd()<EOL><DEDENT>elif len(args)==<NUM_LIT:2>:<EOL><INDENT>bkms[args[<NUM_LIT:0>]] = args[<NUM_LIT:1>]<EOL><DEDENT><DEDENT>self.shell.db['<STR_LIT>'] = bkms<EOL>
Manage IPython's bookmark system.

        %bookmark <name>       - set bookmark to current dir
        %bookmark <name> <dir> - set bookmark to <dir>
        %bookmark -l           - list all bookmarks
        %bookmark -d <name>    - remove bookmark
        %bookmark -r           - remove all bookmarks

        You can later on access a bookmarked folder with::

          %cd -b <name>

        or simply '%cd <name>' if there is no directory called <name> AND
        there is such a bookmark defined.

        Your bookmarks persist through IPython sessions, but they are
        associated with each profile.