def get_search_term(request):
  """Get search term from request.

  Args:
    request: Django request object

  Returns:
    searchterm: string, search term
  """

  # Get search term
  searchterm = request.POST.get('search', '')

  # If no POST data, try GET
  if not searchterm and request.GET.get('search', ''):
    searchterm = request.GET.get('search', '')

  return searchterm.strip()