from typing import Union
import pytz
from datetime import datetime


def localnow(tz: Union[pytz.BaseTzInfo, str] = "US/Central") -> datetime:
    """ Get the current datetime as a localized datetime object with timezone information

    Keyword Arguments:
        tz {Union[pytz.timezone, str]} -- localize datetime to this timezone (default: "US/Central")

    Returns:
        datetime -- localized datetime with tzinfo
    """

    if isinstance(tz, str):
        tz = pytz.timezone(tz)

    return datetime.now().astimezone(tz)