def METHOD_NAME(type, value):
    clean_value = value.replace('\"', '\'').strip()
    if type == 'SFBool':
        return clean_value == 'TRUE'
    elif type == 'SFInt32':
        return int(clean_value)
    elif type == 'SFFloat':
        return float(clean_value)
    elif type == 'SFString':
        if clean_value == '\'\'':
            return ''
        return clean_value[1:-1]
    elif type == 'SFVec2f':
        items = clean_value.split(' ')
        if len(items) != 2:
            raise RuntimeError('Decoding of SFVec2f is wrong.')
        return {'x': float(items[0]), 'y': float(items[1])}
    elif type == 'SFVec3f':
        items = clean_value.split(' ')
        if len(items) != 3:
            raise RuntimeError('Decoding of SFVec3f is wrong.')
        return {'x': float(items[0]), 'y': float(items[1]), 'z': float(items[2])}
    elif type == 'SFColor':
        items = clean_value.split(' ')
        if len(items) != 3:
            raise RuntimeError('Decoding of SFColor is wrong.')
        return {'r': float(items[0]), 'g': float(items[1]), 'b': float(items[2])}
    elif type == 'SFColor':
        items = clean_value.split(' ')
        if len(items) != 3:
            raise RuntimeError('Decoding of SFColor is wrong.')
        return {'r': float(items[0]), 'g': float(items[1]), 'b': float(items[2])}
    elif type == 'SFRotation':
        items = clean_value.split(' ')
        if len(items) != 4:
            raise RuntimeError('Decoding of SFRotation is wrong.')
        return {'x': float(items[0]), 'y': float(items[1]), 'z': float(items[2]), 'a': float(items[3])}
    elif type == 'SFNode':
        if clean_value != 'NULL':
            raise RuntimeError('Values other than NULL not supported yet.')
        return None
    elif type.startswith('MF'):
        if clean_value == '[]' or clean_value == '[ ]':
            return []
        # if not empty
        if clean_value.startswith('['):
            clean_value = clean_value[1:-1]
        clean_value = clean_value.split(',')
        items = []
        single_type = 'S' + type[1:]
        for item in clean_value:
            items.append(METHOD_NAME(single_type, item))
        return items
    return None