The MAF Sensor (Mass Air Flow) is located in the air induction system between the air filter and the throttle body.
Be certain to inspect very well for any air or vacuum leaks in the air induction system or for any loose hose clamps or fasteners in the air induction system, especially between the MAF Sensor and the throttle body. There can be no un-metered air entering the engine or the engine performance will be effected and the check engine light, or MIL (Malfunction Indicator Light) will come on, and P0170 is only one DTC (Data Trouble Code) that un-metered air can cause.
Also, be certain to check for any obstuctions on the air velocity grid to the MAF Sensor, or in the air flow to the MAF Sensor such as a plugged up air filter, or something sucked up into the air intake for the air cleaner assembly.
The MAF Sensor can be removed from the MAF housing and cleaned using carburetor cleaner in a spray can to clean off the fine dust that often builds up on the air velocity sensor part of the MAF Sensor and causes poor performance from the MAF Sensor. (it will require a tamper resistant torx bit, and note the position that the MAF Sensor is positioned in the MAF housing so that it is installed back into the MAF housing properly)
Then clean off the MAF Sensor with the carburetor spray. (From a spray can only, and do not submerge the MAF sensor in any type of water, cleaner, or solvent, or the MAF Sensor will be damaged)
If cleaning the MAF Sensor does not solve the problem, then replace the MAF Sensor and be sure to install it with the air velocity grid facing the air filter, and be sure to tighten all the hose clamps or fasteners well.
Here are a few links to MAF Sensors for that vehicle, and an image to help assist you.
Replacement MAF- $23.27
Bosch MAF- $134.95
Beck Arnley MAF- $295.60