<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_border_attr(self, attr, value, borders):
 """Sets border attribute by adjusting selection to borders Parameters attr: String in ["borderwidth", "bordercolor"] \tBorder attribute that shall be changed value: wx.Colour or Integer \tAttribute value dependent on attribute type borders: Iterable over "top", "bottom", "left", "right", "inner" \tSpecifies to which borders of the selection the attr is applied """


        selection = self.grid.selection
        if not selection:
            selection.cells.append(self.grid.actions.cursor[:2])

        # determine selection for core cells and selection for border cells
        # Then apply according to inner and outer
        # A cell is inner iif it is not at the edge of the selection bbox

        if "inner" in borders:
            if "top" in borders:
                adj_selection = selection + (-1, 0)
                self.set_attr(attr + "_bottom", value, adj_selection)

            if "bottom" in borders:
                self.set_attr(attr + "_bottom", value)

            if "left" in borders:
                adj_selection = selection + (0, -1)
                self.set_attr(attr + "_right", value, adj_selection)

            if "right" in borders:
                self.set_attr(attr + "_right", value)

        else:
            # Adjust selection so that only bounding box edge is in selection
            bbox_tl, bbox_lr = selection.get_bbox()
            if "top" in borders:
                adj_selection = Selection([bbox_tl],
                                          [(bbox_tl[0], bbox_lr[1])],
                                          [], [], []) + (-1, 0)
                self.set_attr(attr + "_bottom", value, adj_selection)

            if "bottom" in borders:
                adj_selection = Selection([(bbox_lr[0], bbox_tl[1])],
                                          [bbox_lr], [], [], [])
                self.set_attr(attr + "_bottom", value, adj_selection)

            if "left" in borders:
                adj_selection = Selection([bbox_tl],
                                          [(bbox_lr[0], bbox_tl[1])],
                                          [], [], []) + (0, -1)
                self.set_attr(attr + "_right", value, adj_selection)

            if "right" in borders:
                adj_selection = Selection([(bbox_tl[0], bbox_lr[1])],
                                          [bbox_lr], [], [], [])
                self.set_attr(attr + "_right", value, adj_selection)