def set_crs(df, crs):
    """
    Sets the coordinate reference system `crs` based on the information in the dataframe `df`.
    :param df: DataFrame
    :param crs: Coordinate Reference System
    :return:
    """
    if type(df.crs).__name__ in ['CRS']:
        if str(df.crs).upper() != crs:
            df = df.to_crs(crs)
    else:
        df.crs = crs
    return df