def rootname(name):
    """Remove all extensions from name

    Arguments:
      name: name of a file

    Returns:
      Leading part of name up to first dot, i.e. name without any
      trailing extensions.

    """
    try:
        i = name.index('.')
        return name[0:i]
    except ValueError:
        # No dot
        return name