def discoverCurrentWorkingDevice(procMounts='<STR_LIT>'):
possibilities = []<EOL>cwd = os.getcwd()<EOL>with file(procMounts, '<STR_LIT:rb>') as f:<EOL><INDENT>for L in f:<EOL><INDENT>parts = L.split()<EOL>if cwd.startswith(parts[<NUM_LIT:1>]):<EOL><INDENT>possibilities.append((len(parts[<NUM_LIT:1>]), parts[<NUM_LIT:0>]))<EOL><DEDENT><DEDENT><DEDENT>possibilities.sort()<EOL>try:<EOL><INDENT>return possibilities[-<NUM_LIT:1>][-<NUM_LIT:1>]<EOL><DEDENT>except IndexError:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>
Return a short string naming the device which backs the current working
directory, ie C{/dev/hda1}.