def check_process_name(name, p):
    if p.name == name:
        return True
    # name can be truncated and a script so check also if it can be an
    # argument to an interpreter
    if len(p.cmdline) > 0 and os.path.basename(p.cmdline[0]) == name:
        return True
    if len(p.cmdline) > 1 and os.path.basename(p.cmdline[1]) == name:
        return True
    return False
dataset/ETHPy150Open openstack/monitoring-for-openstack/oschecks/utils.py/check_process_name/original