def deduce_helpful_msg(req):
    # type: (str) -> str
    """Returns helpful msg in case requirements file does not exist,
    or cannot be parsed.

    :params req: Requirements file path
    """
    msg = ""
    if os.path.exists(req):
        msg = " It does exist."
        # Try to parse and check if it is a requirements file.
        try:
            with open(req, 'r') as fp:
                # parse first line only
                next(parse_requirements(fp.read()))
                msg += (
                    "The argument you provided "
                    "({}) appears to be a"
                    " requirements file. If that is the"
                    " case, use the '-r' flag to install"
                    " the packages specified within it."
                ).format(req)
        except RequirementParseError:
            logger.debug("Cannot parse '{}' as requirements \
            file".format(req), exc_info=True)
    else:
        msg += " File '{}' does not exist.".format(req)
    return msg
Returns helpful msg in case requirements file does not exist,
    or cannot be parsed.

    :params req: Requirements file path
    
product/gradle-plugin/src/main/python/pip/_internal/req/constructors.py