def METHOD_NAME(self, value, raise_exception=True):
    """
    Convert number to int or float.
    :param value: string with number inside
    :param raise_exception: if True then raise exception if cannot convert to number, If False then return 0.
    :return: int or float with value.
    """
    ret_val = 0
    try:
        ret_val = int(value)
    except ValueError:
        try:
            ret_val = float(value)
        except ValueError as ex:
            if raise_exception:
                raise ex
    return ret_val