from typing import Union


def atmospeheres_to_bars(atm: float, unit: str) -> Union[float, str]:
    """
    This function converts atm to bar
    Wikipedia reference: https://en.wikipedia.org/wiki/Standard_atmosphere_(unit)
    Wikipedia reference: https://en.wikipedia.org/wiki/Bar_(unit)

    >>> atmospeheres_to_bars(2.5, "atm")
    2.533125
    >>> atmospeheres_to_bars("12", "atm")
    12.158999999999999
    >>> atmospeheres_to_bars(0, "atm")
    0.0
    >>> atmospeheres_to_bars(35, "mmHg")
    'Invalid unit'
    >>> atmospeheres_to_bars("atmospheres", "atm")
    Traceback (most recent call last):
    ...
    ValueError: could not convert string to float: 'atmospheres'
    """
    if unit == "atm":
        bar = float(atm) * 1.01325
        return bar
    else:
        return "Invalid unit"