'return the position of the bbox anchored at the parentbbox
with the loc code, with the borderpad.'

def _get_anchored_bbox(self, loc, bbox, parentbbox, borderpad):

    assert (loc in range(1, 11))
    (BEST, UR, UL, LL, LR, R, CL, CR, LC, UC, C) = xrange(11)
    anchor_coefs = {UR: u'NE', UL: u'NW', LL: u'SW', LR: u'SE', R: u'E', CL: u'W', CR: u'E', LC: u'S', UC: u'N', C: u'C'}
    c = anchor_coefs[loc]
    container = parentbbox.padded((- borderpad))
    anchored_box = bbox.anchored(c, container=container)
    return (anchored_box.x0, anchored_box.y0)
