def __imul__(self, dim):

        if isinstance(dim, float):
            self.value *= dim

        if isinstance(dim, Dim):
            if dim.unit == self.unit:
                self.value *= dim.value
            else:
                raise exceptions.IncompatibleDim()
    def tolpi(self, ceil: bool = False, obj: bool = False):
        """
        Returns the value of Dim in LPI unit.
        Raise ValueError if Dim is not convertable

        :type ceil: boolean
        :param ceil: If True, apply ceil to returned value
        :type obj: boolean
        :param obj: If True, returns a Dim object instead of value.
        """

        if self.unit == "dpi":
            return self._convertorval(obj, self._ceil(self.value / 16), "lpi")
        else:
            raise exceptions.IncompatibleDim("Can't convert that into LPI")
    def topc(self, ceil: bool, obj: bool = False):
        """
        Returns the value of Dim as integer percentage.
        Raise ValueError if Dim is not convertable

        :type ceil: boolean
        :param ceil: If True, apply ceil to returned value
        :type obj: boolean
        :param obj: If True, returns a Dim object instead of value.
        """

        if self.unit == "pcdecim":
            return self._convertorval(obj, self._ceil(self.value * 100), "pc")
        else:
            raise exceptions.IncompatibleDim(
                "Can't convert that into percentage")
    def tomm(self, ceil: bool = False, obj: bool = False):
        """
        Returns the value of Dim in milimeter unit.

        :type ceil: boolean
        :param ceil: If True, apply ceil to returned value
        :type obj: boolean
        :param obj: If True, returns a Dim object instead of value.
        """

        if not self.is_convertable_length():
            raise exceptions.IncompatibleDim(
                "Can't convert that into milimeters")

        if self.unit == "pica":
            return self._convertorval(
                obj, self._ceil(self.value * Dim.PICA_TO_MM, ceil), "mm")

        if self.unit == "mm":
            return self._convertorval(obj, self._ceil(self.value, ceil), "mm")
    def topica(self, ceil: bool = False, obj: bool = False):
        """
        Returns the value of Dim in pica point unit.
        Raise ValueError if Dim is not convertable

        :type ceil: boolean
        :param ceil: If True, apply ceil to returned value
        :type obj: boolean
        :param obj: If True, returns a Dim object instead of value.
        """

        if not self.is_convertable_length():
            raise exceptions.IncompatibleDim(
                "Can't convert that ({}) into pica points".format(self.unit))

        if self.unit == "pica":
            return self._convertorval(obj, self._ceil(self.value, ceil),
                                      "pica")

        if self.unit == "mm":
            return self._convertorval(
                obj, self._ceil(self.value / Dim.PICA_TO_MM, ceil), "pica")