<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nodes_on_bdry(self):
 """Encoding of grid points lying on the boundary. Examples -------- Using global option (default ``False``):
 False True ``False`` in axis 0, ``True`` in axis 1: (False, True) In axis 0, ``False`` left and ``True`` right, in axis 1 ``False``: ((False, True), False) """

        if self.size == 0:
            return True

        nodes_on_bdry = []
        for on_bdry in self.nodes_on_bdry_byaxis:
            left, right = on_bdry
            if left == right:
                nodes_on_bdry.append(left)
            else:
                nodes_on_bdry.append((left, right))
        if all(on_bdry == nodes_on_bdry[0] for on_bdry in nodes_on_bdry[1:]):
            return nodes_on_bdry[0]
        else:
            return tuple(nodes_on_bdry)