'Get the PMS server identifier.
Required parameters:
hostname (str):     \'localhost\' or \'192.160.0.10\'
port (int):         32400
Optional parameters:
ssl (int):          0 or 1
remote (int):       0 or 1
Returns:
string:             The unique PMS identifier'

@cherrypy.expose
@cherrypy.tools.json_out()
@requireAuth(member_of('admin'))
@addtoapi()
def get_server_id(self, hostname=None, port=None, identifier=None, ssl=0, remote=0, **kwargs):

    if ((not identifier) and hostname and port):
        plex_tv = plextv.PlexTV()
        servers = plex_tv.discover()
        ip_address = get_ip(hostname)
        for server in servers:
            if (((server['ip'] == hostname) or (server['ip'] == ip_address)) and (server['port'] == port)):
                identifier = server['clientIdentifier']
                break
        if (not identifier):
            request_handler = http_handler.HTTPHandler(host=hostname, port=port, token=None)
            uri = '/identity'
            request = request_handler.make_request(uri=uri, proto='http', request_type='GET', output_format='xml', no_token=True, timeout=10)
            if request:
                xml_head = request.getElementsByTagName('MediaContainer')[0]
                identifier = xml_head.getAttribute('machineIdentifier')
    if identifier:
        return identifier
    else:
        logger.warn('Unable    to    retrieve    the    PMS    identifier.')
        return None
