Create new image group at given SCO-API by uploading local file.
        Expects an tar-archive containing images in the image group. Allows to
        update properties of created resource.

        Parameters
        ----------
        url : string
            Url to POST image group create request
        filename : string
            Path to tar-archive on local disk
        options : Dictionary, optional
            Values for image group options. Argument may be None.
        properties : Dictionary
            Set of additional properties for image group (may be None)

        Returns
        -------
        string
            Url of created image group resource

def create(url, filename, options, properties):
        """Create new image group at given SCO-API by uploading local file.
        Expects an tar-archive containing images in the image group. Allows to
        update properties of created resource.

        Parameters
        ----------
        url : string
            Url to POST image group create request
        filename : string
            Path to tar-archive on local disk
        options : Dictionary, optional
            Values for image group options. Argument may be None.
        properties : Dictionary
            Set of additional properties for image group (may be None)

        Returns
        -------
        string
            Url of created image group resource
        """
        # Ensure that the file has valid suffix
        if not has_tar_suffix(filename):
            raise ValueError('invalid file suffix: ' + filename)
        # Upload file to create image group. If response is not 201 the uploaded
        # file is not a valid tar file
        files = {'file': open(filename, 'rb')}
        response = requests.post(url, files=files)
        if response.status_code != 201:
            raise ValueError('invalid file: ' + filename)
        # Get image group HATEOAS references from successful response
        links = references_to_dict(response.json()['links'])
        resource_url = links[REF_SELF]
        # Update image group options if given
        if not options is None:
            obj_ops = []
            # Catch TypeErrors if properties is not a list.
            try:
                for opt in options:
                    obj_ops.append({'name' : opt, 'value' : options[opt]})
            except TypeError as ex:
                raise ValueError('invalid option set')
            try:
                req = urllib2.Request(links[REF_UPDATE_OPTIONS])
                req.add_header('Content-Type', 'application/json')
                response = urllib2.urlopen(
                    req,
                    json.dumps({'options' : obj_ops})
                )
            except urllib2.URLError as ex:
                raise ValueError(str(ex))
        # Update image group properties if given
        if not properties is None:
            obj_props = []
            # Catch TypeErrors if properties is not a list.
            try:
                for key in properties:
                    obj_props.append({'key':key, 'value':properties[key]})
            except TypeError as ex:
                raise ValueError('invalid property set')
            try:
                req = urllib2.Request(links[REF_UPSERT_PROPERTIES])
                req.add_header('Content-Type', 'application/json')
                response = urllib2.urlopen(
                    req,
                    json.dumps({'properties' : obj_props})
                )
            except urllib2.URLError as ex:
                raise ValueError(str(ex))
        return resource_url