@classmethod
def by_pid(cls, data_dir, pid):
    """Retrieves PID file from given directory by PID value"""
    for candidate_pid_file in cls.all(data_dir):
        if candidate_pid_file.pid == pid:
            pid_file = candidate_pid_file
            break
    else:
        pid_file = None
    return pid_file
