<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get(id_, hwid, type_, unit, precision, as_json):
 """Get temperature of a specific sensor"""

    if id_ and (hwid or type_):
        raise click.BadOptionUsage(
            "If --id is given --hwid and --type are not allowed."
        )

    if id_:
        try:
            sensor = W1ThermSensor.get_available_sensors()[id_ - 1]
        except IndexError:
            raise click.BadOptionUsage(
                "No sensor with id {0} available. "
                "Use the ls command to show all available sensors.".format(id_)
            )
    else:
        sensor = W1ThermSensor(type_, hwid)

    if precision:
        sensor.set_precision(precision, persist=False)

    temperature = sensor.get_temperature(unit)

    if as_json:
        data = {
            "hwid": sensor.id,
            "type": sensor.type_name,
            "temperature": temperature,
            "unit": unit,
        }
        click.echo(json.dumps(data, indent=4, sort_keys=True))
    else:
        click.echo(
            "Sensor {0} measured temperature: {1} {2}".format(
                click.style(sensor.id, bold=True),
                click.style(str(temperature), bold=True),
                click.style(unit, bold=True),
            )
        )