def get_woeid(api, locations) -> list:
    """
    Returns the list of WOEIDs for specific locations if they have trending
    topics.

    Ref:
        `WOEID <https://blog.twitter.com/engineering/en_us/a/2010/woeids-in-twitters-trends.html>`_
        `api.trends_available() <http://docs.tweepy.org/en/latest/api.html?highlight=trends_available
        #API.trends_available>`_

    Args:
        api (tweepy.API): API instance.
        locations (list): A list of str values with locations names.

    Returns:
        A list of str values with WOEIDs.
    """
    trending_locations = api.trends_available()
    # dictionary with all trending locations and their respective woeid.
    location_woeid = {trending_location["name"].lower(): trending_location["woeid"]
                      for trending_location in trending_locations}
    # fill the woeids list for the specific locations.
    woeids = []
    for location in locations:
        if location in location_woeid.keys():
            woeids.append(location_woeid[location])
        else:
            print(f"Info: {location} woeid does not exist in trending topics.")
    return woeids