from datetime import datetime


def str2datetime(input_date):
    """Transform a string to datetime object.

    Args:
        input_date (str): String date of the format Y-m-d. It can
            also be 'today' which will return today's date.

    Returns:
        (`datetime.datetime`)

    """
    if input_date == "today":
        return datetime.today()
    else:
        return datetime.strptime(input_date, "%Y-%m-%d")