def _check_part_size(self, part_size, total_size):
        """
        Check the part size:

        - check whether we have a part size, if not: use default.
        - check whether part size is a power of two: if not,
            increase until it is.
        - check wehther part size is big enough for the archive
            total size: if not, increase until it is.

        Return part size to use.
        """
        def _part_size_for_total_size(total_size):
            return self._next_power_of_2(
                int(math.ceil(
                    float(total_size) / (1024 * 1024 * self.MAX_PARTS)
                )))

        if 0 < part_size:
            if total_size > 0:
                part_size = _part_size_for_total_size(total_size)
            else:
                part_size = GlacierWriter.DEFAULT_PART_SIZE
        else:
            ps = self._next_power_of_2(part_size)
            if not ps == part_size:
                self.logger.warning("""\
Part size in MB must be a power of 2, \
e.g. 1, 2, 4, 8 MB; automatically increased part size from %s to %s.\
""" % (part_size, ps))

            part_size = ps

        # Check if user specified value is big enough, and adjust if needed.
        if total_size > part_size * 1024 * 1024 * self.MAX_PARTS:
            part_size = _part_size_for_total_size(total_size)
            self.logger.warning("Part size given is too small; \
using %s MB parts to upload." % part_size)

        return part_size
dataset/ETHPy150Open uskudnik/amazon-glacier-cmd-interface/glacier/GlacierWrapper.py/GlacierWrapper._check_part_size/swapped operands of `<`