<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_program_cmd(name, pconfig, config, default):
 """Retrieve commandline of a program. """

    if pconfig is None:
        return name
    elif isinstance(pconfig, six.string_types):
        return pconfig
    elif "cmd" in pconfig:
        return pconfig["cmd"]
    elif default is not None:
        return default
    else:
        return name