def clean_site_name(s):
    """
    Splits site name by _ (underscore), takes no more than first three parts and joins them with _.
    This way site name always have at most three parts, separated by _.
    First three parts represent a tier, a country and a lab/university name.
    """
    split = s.split('_')
    split = split[0:3]

    # Remove empty strings which may appear when s is T0_USA_
    split = filter(None, split)

    join = '_'.join(split)
    return join