<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_req(req):
 """Checks if a given req is the latest version available."""

    if not isinstance(req, Requirement):
        return None

    info = get_package_info(req.name)
    newest_version = _get_newest_version(info)

    if _is_pinned(req) and _is_version_range(req):
        return None

    current_spec = next(iter(req.specifier)) if req.specifier else None
    current_version = current_spec.version if current_spec else None
    if current_version != newest_version:
        return req.name, current_version, newest_version