:param image: One of file object, path, or URL
        :return: Base64 of image

def image_to_base64(self, image):
        """
        :param image: One of file object, path, or URL
        :return: Base64 of image
        """
        if isinstance(image, file_):
            return base64.b64encode(image.read())
        elif isinstance(image, basestring):
            if image.startswith("http"):
                # it's URL
                return base64.b64encode(requests.get(image).content)
            # it's path
            with open(image) as f:
                return base64.b64encode(f.read())

        raise ValueError("Unrecognizable image param: it must one of"
                         " file object, path or URL, not %s" % type(image))