def run_cmd_if_file_missing(cmd, fname, out=os.path.devnull, err=os.path.devnull):
    """Runs an external command if file is absent.

    :param list cmd: Command to run.
    :param str fname: Path to the file, which existence is being checked.
    :param str out: Output file
    :param str err: Error file
    :return: True if cmd was executed, False otherwise
    :rtype: boolean
    """

    if fname is None or not os.path.exists(fname):
        run_cmd(cmd, out, err)
        return True
    else:
        return False