def extension(url):
  if url:
    path = urlparse.urlparse(url).path
    ext = os.path.splitext(path)[1]
    return ext
  else:
    return None
Return the file extension, given (typically) a URL.
dataset/ETHPy150Open miklevin/pipulate/common.py/extension