function to get team