import logging
import requests

logger = logging.getLogger(__name__)

DEFAULT_REST_ADMIN_PATH = 'rest-admin'
DEFAULT_API_VERSION = 'v1'
DEFAULT_CERT_VERIFY = True

class UnityApiClient:

    def __init__(self, server_base_url, **kwargs):
        """Constructs a new :class:`UnityApiClient <UnityApiClient>`.

        :param server_base_url: base URL of the Unity IDM server.
        :param rest_admin_path: API endpoint path. Defaults to 
            `rest-admin`.
        :param api_version: API version. Defaults to `v1`.
        :param auth: (optional) Auth tuple to enable HTTP Auth.
        :param cert_verify: (optional) whether the server SSL cert
            will be verified. A CA_BUNDLE path can also be provided. 
            Defaults to ``True``.
        """

        self.__session = requests.Session()
        if 'auth' in kwargs:
            self.__session.auth = kwargs['auth']
        self.__session.verify = kwargs.setdefault('cert_verify', 
            DEFAULT_CERT_VERIFY)
        self.__api_base_url = self._build_api_base_url(
            server_base_url,
            kwargs.setdefault('rest_admin_path', DEFAULT_REST_ADMIN_PATH),
            kwargs.setdefault('api_version', DEFAULT_API_VERSION))

    def get_group(self, group_path=None):
        """Returns all members and subgroups of the specified group.

        If ``group_path`` is not supplied, then the method returns all
        root-level groups and members. 

        @param group_path: (optional) path to group whose subgroups
            and members to retrieve. 

        Example output::

             {
               "subGroups" : [ ],
               "members" : [ 3 ]
             }

        """
        if group_path is not None:
            path = '/group/' + group_path
        else:
            path = '/group/%2F'
        try:
            response = self.__session.get(self.__api_base_url + path)
            response.raise_for_status()
            response = response.json()
        except (requests.HTTPError, requests.ConnectionError), error:
            raise Exception(error.message)

        return response

    def _build_api_base_url(self,
        server_base_url, 
        rest_admin_path, 
        api_version):
        
        return '{0}/{1}/{2}'.format(server_base_url, 
                                    rest_admin_path, 
                                    api_version) 

@@ -1565,14 +1565,16 @@
 ple 
-output
+response
 ::%0A%0A
@@ -1774,16 +1774,16 @@
   else:%0A
-
         
@@ -2107,16 +2107,1710 @@
 sponse%0A%0A
+    def get_entity(self, entity_id):%0A        %22%22%22Returns information about the identified entity, including%0A        its status and all identities.%0A%0A        @param entity_id: numeric identifier of the entity whose status%0A            and identities to retrieve.%0A%0A        Example response::%0A%0A             %7B%0A               %22id%22 : 3,%0A               %22state%22 : %22valid%22,%0A               %22identities%22 : %5B %7B%0A                 %22typeId%22 : %22userName%22,%0A                 %22value%22 : %22tested%22,%0A                 %22target%22 : null,%0A                 %22realm%22 : null,%0A                 %22local%22 : true,%0A                 %22entityId%22 : 3,%0A                 %22comparableValue%22 : %22tested%22%0A               %7D, %7B%0A                 %22typeId%22 : %22persistent%22,%0A                 %22value%22 : %22129ffe63-63b9-4467-ae24-6bc889327b0d%22,%0A                 %22target%22 : null,%0A                 %22realm%22 : null,%0A                 %22local%22 : true,%0A                 %22entityId%22 : 3,%0A                 %22comparableValue%22 : %22129ffe63-63b9-4467-ae24-6bc889327b0d%22%0A               %7D %5D,%0A               %22credentialInfo%22 : %7B%0A                 %22credentialRequirementId%22 : %22cr-pass%22,%0A                 %22credentialsState%22 : %7B%0A                   %22credential1%22 : %7B%0A                     %22state%22 : %22notSet%22,%0A                     %22extraInformation%22 : %22%22%0A                   %7D%0A                 %7D%0A               %7D%0A             %7D%0A%0A        %22%22%22%0A        path = '/entity/' + str(entity_id)%0A        try:%0A            response = self.__session.get(self.__api_base_url + path)%0A            response.raise_for_status()%0A            response = response.json()%0A        except (requests.HTTPError, requests.ConnectionError), error:%0A            raise Exception(error.message)%0A%0A        return response%0A%0A
     def 

Add support for retrieving entity status and identity information