@staticmethod
def size_to_int(size_str: str) ->int:
    """Parses size string trying to get size as int from it.

        Supported formats:
            "123" => 123
            "12m" => 12 * 1024

        :param size_str:
        :return: filesize as int

        :raise Raises InvalidArgument if cannot parse string
        """
    import re
    size_str = size_str.strip().replace(' ', '').lower()
    match = re.match('^([0-9]+)([bkmgt]?)$', size_str)
    if match is None:
        raise ValueError('Unable to parse provided size string %r' % size_str)
    unit = match.group(2) if match.group(2) != '' else 'b'
    return int(match.group(1)) * pow(1024, 'bkmgt'.find(unit))
