def clean_wikilink(link):
  """Applies media wiki link formatting (e.g., stripping, capitalizing, etc.)"""
  clean_link = link.strip()
  try:
    clean_link = clean_link[0].upper() + clean_link[1:]
  except IndexError:
    return link
  clean_link = RE_BREADCRUMB.split(clean_link)[0]
  clean_link = clean_link.replace(" ", "_")
  return clean_link
Applies media wiki link formatting (e.g., stripping, capitalizing, etc.)
language/fruit/wiki_utils.py