How to Lerp Player 180 Degrees Locally on Y Axis?

This is a very difficult question.

I’ve done a ton f Googling and haven’t found and answer that works. They all rotate globally.
I want to rotate my player 180 degrees when I push the space bar.
The player needs to rotate 180 degrees relative to the direction it’s facing.
Any help is really appreciated.
Thanks!

Here is the local rotation script you have to modify for your needs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotatePlayer : MonoBehaviour {

	// Use this for initialization
	void Start () {
		Y = transform.localRotation.eulerAngles.y;
	}

	public float Y;
	public bool Hit;
	void Update () {
		if (Input.GetKeyDown(KeyCode.Space)) {
			Hit = true;
			StartCoroutine (RotatePlayerY (transform.localRotation.eulerAngles.y + 180f));
			Debug.Log (transform.localRotation.eulerAngles.y + 180f);
		}
		if (Input.GetKey(KeyCode.Space)) {
			Hit = true;
		} else {
			Hit = false;
		}
	}


	IEnumerator RotatePlayerY(float to){
		while (Hit) {
			Y += 0.9f;
			transform.localRotation = Quaternion.Euler (transform.rotation.x, Y, transform.rotation.z);
			yield return new WaitForEndOfFrame ();
		}
	}

}