def day_of_year(localdate):
    """
    returns the day of year [1..365 or 366] for a particular date and time

    input:
    - date and time in Python datetime format including timezone
    (time and timezone may be omitted)

    returns:
    - day of year 'd', integer
    the returned day of year is for the UTC date and time corresponding
    to a local date, time, and timezone. If time or timezone are omitted,
    the day od year 'd' refers to the local date.

    """
    d = localdate.utctimetuple().tm_yday
    return d
