@click.command(name='bake.state_file', help="Write election and candidate data "
    "along with a manifest to structured files")
@state_file_options
def state_file(state, fmt='csv', outputdir=None, datefilter=None,
    electiontype=None, level=None, raw=False):
    # TODO: Decide if datefilter should be required due to performance
    # considerations.
 
    # TODO: Implement filtering by office, district and party after the 
    # the data is standardized

    # TODO: Filtering by election type and level

    timestamp = datetime.now()

    filter_kwargs = {}
    if electiontype:
        filter_kwargs['election_type'] = electiontype

    if level:
        filter_kwargs['reporting_level'] = level

    if raw:
        baker = RawBaker(state=state, datefilter=datefilter, **filter_kwargs)
    else:
        baker = Baker(state=state, datefilter=datefilter, **filter_kwargs)

    baker.collect_items() \
         .write(fmt, outputdir=outputdir, timestamp=timestamp) \
         .write_manifest(outputdir=outputdir, timestamp=timestamp)
Turn off media player.
dataset/ETHPy150Open openelections/openelections-core/openelex/tasks/bake.py/state_file--crossover with--dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/media_player/denon.py/DenonDevice.turn_off