def file_ext(filename):
    """return the file extension, including the ``.``

    >>> file_ext('foo.tar.gz')
    '.tar.gz'

    >>> file_ext('.emacs')
    ''

    >>> file_ext('.mrjob.conf')
    '.conf'
    """
    stripped_name = filename.lstrip('.')
    dot_index = stripped_name.find('.')
    if dot_index == -1:
        return ''
    return stripped_name[dot_index:]
