from typing import Optional
import random


def get_invert(invert: Optional[bool]) -> bool:
    """
    Automatically generate an invert value if missing (None).
    If invert is not missing, then simply return the input value
    """
    if invert is None:
        invert = random.sample([True, False], 1)[0]
    return invert