def get_write_target_stats_options(**kwargs):
    """
    Get optional arguments for write_target_stats function.

    Retrieves the keywords supplied to the WRITE_TARGET_STATS 
    function (**KWARGS), and returns the values in a OPTION dictionary. 
    Default values are assigned to selected optional arguments. The 
    function will terminate with an error if an unrecognized optional 
    argument is supplied.
 
    INPUTS:
    **kwargs : keyword argument list
 
    OUTPUTS:
    option : data structure containing option values.
    option['title']     : title descriptor for data set.
    option['overwrite'] : boolean to overwrite Excel file.
   
    LIST OF OPTIONS:
      A title description for each dataset TITLE can be optionally 
    provided as well as an overwrite option if the file name currently
    exists.
   
    label = label : label for each data point in target diagram, e.g. 
                    'OC445 (CB)'
    overwrite = boolean : true/false flag to overwrite Excel file
    title = title : title descriptor for each data set in data, e.g. 
                   'Expt. 01.0'
  
    Author: Peter A. Rochford
    Acorn Science & Innovation
    prochford@acornsi.com

    Created on Dec 10, 2016

    @author: rochfordp  
    """
    from skill_metrics import check_on_off
    nargin = len(kwargs)
    option = {}
    option['overwrite'] = False
    option['label'] = []
    option['title'] = ''
    if nargin == 0:
        return option
    for optname, optvalue in kwargs.items():
        optname = optname.lower()
        if not optname in option:
            raise ValueError('Unrecognized option: ' + optname)
        else:
            option[optname] = optvalue
            if optname == 'overwrite':
                option['overwrite'] = check_on_off(option['overwrite'])
    return option
