def measure_temp(filename=None):
    """Returns the core temperature in Celsius.
    """
    if filename is not None:
        with open(filename, "r") as f:
            temp = float(f.read()) / 1000
    else:
        # Using vcgencmd is specific to the raspberry pi
        sys_tempfile=open("/sys/class/thermal/thermal_zone0/temp", "r")
        sys_temp =sys_tempfile.read()
        sys_tempfile.close()
        temp_int = int(sys_temp)
        temp = float(temp_int/1000)
    return temp