def _get_station_id(tr):
    """
    Get station id of a given trace.

    :param tr: trace
    :return station_id: station id formatted as '{newwork}.{station}.{location}'.
    """

    s = tr.id
    s = s.split(".")
    if s[2] == "":
        station_id = ".".join(s[:2])
    else:
        station_id = ".".join(s[:3])

    return station_id