Register an image file as a user avatar.

        The avatar created is temporary and must be confirmed before it can
        be used.

        Avatar images are specified by a filename, size, and file object. By default, the client will attempt to
        autodetect the picture's content type: this mechanism relies on ``libmagic`` and will not work out of the box
        on Windows systems (see http://filemagic.readthedocs.org/en/latest/guide.html for details on how to install
        support). The ``contentType`` argument can be used to explicitly set the value (note that JIRA will reject any
        type other than the well-known ones for images, e.g. ``image/jpg``, ``image/png``, etc.)

        This method returns a dict of properties that can be used to crop a subarea of a larger image for use. This
        dict should be saved and passed to :py:meth:`confirm_user_avatar` to finish the avatar creation process. If you
        want to cut out the middleman and confirm the avatar with JIRA's default cropping, pass the ``auto_confirm``
        argument with a truthy value and :py:meth:`confirm_user_avatar` will be called for you before this method
        returns.

        :param user: User to register the avatar for
        :type user: str
        :param filename: name of the avatar file
        :type filename: str
        :param size: size of the avatar file
        :type size: int
        :param avatar_img: file-like object containing the avatar
        :type avatar_img: bytes
        :param contentType: explicit specification for the avatar image's content-type
        :type contentType: Optional[Any]
        :param auto_confirm: whether to automatically confirm the temporary avatar by calling
            :py:meth:`confirm_user_avatar` with the return value of this method. (Default: False)
        :type auto_confirm: bool

        :rtype: NoReturn

def create_temp_user_avatar(self,
                                user,
                                filename,
                                size,
                                avatar_img,
                                contentType=None,
                                auto_confirm=False,
                                ):
        """Register an image file as a user avatar.

        The avatar created is temporary and must be confirmed before it can
        be used.

        Avatar images are specified by a filename, size, and file object. By default, the client will attempt to
        autodetect the picture's content type: this mechanism relies on ``libmagic`` and will not work out of the box
        on Windows systems (see http://filemagic.readthedocs.org/en/latest/guide.html for details on how to install
        support). The ``contentType`` argument can be used to explicitly set the value (note that JIRA will reject any
        type other than the well-known ones for images, e.g. ``image/jpg``, ``image/png``, etc.)

        This method returns a dict of properties that can be used to crop a subarea of a larger image for use. This
        dict should be saved and passed to :py:meth:`confirm_user_avatar` to finish the avatar creation process. If you
        want to cut out the middleman and confirm the avatar with JIRA's default cropping, pass the ``auto_confirm``
        argument with a truthy value and :py:meth:`confirm_user_avatar` will be called for you before this method
        returns.

        :param user: User to register the avatar for
        :type user: str
        :param filename: name of the avatar file
        :type filename: str
        :param size: size of the avatar file
        :type size: int
        :param avatar_img: file-like object containing the avatar
        :type avatar_img: bytes
        :param contentType: explicit specification for the avatar image's content-type
        :type contentType: Optional[Any]
        :param auto_confirm: whether to automatically confirm the temporary avatar by calling
            :py:meth:`confirm_user_avatar` with the return value of this method. (Default: False)
        :type auto_confirm: bool

        :rtype: NoReturn
        """
        size_from_file = os.path.getsize(filename)
        if size != size_from_file:
            size = size_from_file

        # remove path from filename
        filename = os.path.split(filename)[1]

        params = {
            'username': user,
            'filename': filename,
            'size': size}

        headers = {'X-Atlassian-Token': 'no-check'}
        if contentType is not None:
            headers['content-type'] = contentType
        else:
            # try to detect content-type, this may return None
            headers['content-type'] = self._get_mime_type(avatar_img)

        url = self._get_url('user/avatar/temporary')
        r = self._session.post(
            url, params=params, headers=headers, data=avatar_img)

        cropping_properties = json_loads(r)
        if auto_confirm:
            return self.confirm_user_avatar(user, cropping_properties)
        else:
            return cropping_properties