def get_tweets(query, n, api):
    """
    Provided with authentication tweety searches twitter using search terms provided by query
    :param query: search terms
    :param api: twitter authentication
    :param n: number of tweets to get
    :returns: search results
    """
    try:
        # using query to search for tweets
        print("Searching twitter.")
        output = api.search(q=query, result_type="recent", count=n)
        return output
    except Exception as e:
        print(e)
        print("Search failed!")