def user_avatar_path(instance, filename):
    """
        Returns the path for user's avatar image under MEDIA_ROOT folder.

        e.g.
            MEDIA_ROOT/avatars/username/avatar.png
    """

    # Select username, 'avatar' static name and then file extention.
    return 'avatars/{0}/{1}.{2}'.format(instance.user.username, 'avatar', filename.split('.')[-1])