<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _calc_order(self, order):
 """Called to set the order of a multi-channel image. The order should be determined by the loader, but this will make a best guess if passed `order` is `None`. """

        if order is not None and order != '':
            self.order = order.upper()
        else:
            shape = self.shape
            if len(shape) <= 2:
                self.order = 'M'
            else:
                depth = shape[-1]
                # TODO: need something better here than a guess!
                if depth == 1:
                    self.order = 'M'
                elif depth == 2:
                    self.order = 'AM'
                elif depth == 3:
                    self.order = 'RGB'
                elif depth == 4:
                    self.order = 'RGBA'