def METHOD_NAME(self):
    try:
        val = self.text
    except AttributeError:
        return 0
    else:
        if isinstance(val, str):
            val = val.replace(',', '.')
        if isinstance(val, float) is False:
            try:
                return int(val)
            except (ValueError, TypeError):
                pass
            try:
                return float(val)
            except (ValueError, TypeError):
                return 0
        else:
            return val