A function to set the prod_state in zenoss.

    Parameters:
        prod_state:     (Required) Integer value of the state
        device:         (Optional) Will use the grain 'fqdn' by default.

    CLI Example:
        salt zenoss.set_prod_state 1000 hostname

def set_prod_state(prod_state, device=None):
    '''
    A function to set the prod_state in zenoss.

    Parameters:
        prod_state:     (Required) Integer value of the state
        device:         (Optional) Will use the grain 'fqdn' by default.

    CLI Example:
        salt zenoss.set_prod_state 1000 hostname
    '''

    if not device:
        device = __salt__['grains.get']('fqdn')

    device_object = find_device(device)

    if not device_object:
        return "Unable to find a device in Zenoss for {0}".format(device)

    log.info('Setting prodState to %d on %s device', prod_state, device)
    data = dict(uids=[device_object['uid']], prodState=prod_state, hashcheck=device_object['hash'])
    return _router_request('DeviceRouter', 'setProductionState', [data])