def get_locator(self, d):
d = abs(d)<EOL>if d<=<NUM_LIT:0>:<EOL><INDENT>locator = MultipleLocator(<NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>try: ld = math.log10(d)<EOL>except OverflowError:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>fld = math.floor(ld)<EOL>base = <NUM_LIT:10>**fld<EOL>if   d >= <NUM_LIT:5>*base : ticksize = base<EOL>elif d >= <NUM_LIT:2>*base : ticksize = base/<NUM_LIT><EOL>else             : ticksize = base/<NUM_LIT><EOL>locator = MultipleLocator(ticksize)<EOL><DEDENT>return locator<EOL>
pick the best locator based on a distance