'Describe the status of the current deployment.'

def status(self, return_json=False):

    def tabular_print(title, value):
        u'\n                                                Convience    function    for    priting    formatted    table    items.\n                                                '
        click.echo((u'%-*s%s' % (32, (click.style((u' DCTB ' + title), fg=u'green') + u':'), str(value))))
        return
    lambda_versions = self.zappa.get_lambda_function_versions(self.lambda_name)
    if (not lambda_versions):
        raise ClickException(click.style((u'No    Lambda    %s    detected    in    %s    -    have    you    deployed    yet?' % (self.lambda_name, self.zappa.aws_region)), fg=u'red'))
    status_dict = collections.OrderedDict()
    status_dict[u'Lambda    Versions'] = len(lambda_versions)
    function_response = self.zappa.lambda_client.get_function(FunctionName=self.lambda_name)
    conf = function_response[u'Configuration']
    self.lambda_arn = conf[u'FunctionArn']
    status_dict[u'Lambda    Name'] = self.lambda_name
    status_dict[u'Lambda    ARN'] = self.lambda_arn
    status_dict[u'Lambda    Role    ARN'] = conf[u'Role']
    status_dict[u'Lambda    Handler'] = conf[u'Handler']
    status_dict[u'Lambda    Code    Size'] = conf[u'CodeSize']
    status_dict[u'Lambda    Version'] = conf[u'Version']
    status_dict[u'Lambda    Last    Modified'] = conf[u'LastModified']
    status_dict[u'Lambda    Memory    Size'] = conf[u'MemorySize']
    status_dict[u'Lambda    Timeout'] = conf[u'Timeout']
    status_dict[u'Lambda    Runtime'] = conf[u'Runtime']
    if (u'VpcConfig' in conf.keys()):
        status_dict[u'Lambda    VPC    ID'] = conf.get(u'VpcConfig', {}).get(u'VpcId', u'Not    assigned')
    else:
        status_dict[u'Lambda    VPC    ID'] = None
    try:
        function_invocations = self.zappa.cloudwatch.get_metric_statistics(Namespace=u'AWS/Lambda', MetricName=u'Invocations', StartTime=(datetime.utcnow() - timedelta(days=1)), EndTime=datetime.utcnow(), Period=1440, Statistics=[u'Sum'], Dimensions=[{u'Name': u'FunctionName', u'Value': u'{}'.format(self.lambda_name)}])[u'Datapoints'][0][u'Sum']
    except Exception as e:
        function_invocations = 0
    try:
        function_errors = self.zappa.cloudwatch.get_metric_statistics(Namespace=u'AWS/Lambda', MetricName=u'Errors', StartTime=(datetime.utcnow() - timedelta(days=1)), EndTime=datetime.utcnow(), Period=1440, Statistics=[u'Sum'], Dimensions=[{u'Name': u'FunctionName', u'Value': u'{}'.format(self.lambda_name)}])[u'Datapoints'][0][u'Sum']
    except Exception as e:
        function_errors = 0
    try:
        error_rate = u'{0:.2f}%'.format(((function_errors / function_invocations) * 100))
    except:
        error_rate = u'Error    calculating'
    status_dict[u'Invocations    (24h)'] = int(function_invocations)
    status_dict[u'Errors    (24h)'] = int(function_errors)
    status_dict[u'Error    Rate    (24h)'] = error_rate
    if self.use_apigateway:
        api_url = self.zappa.get_api_url(self.lambda_name, self.api_stage)
        status_dict[u'API    Gateway    URL'] = api_url
        api_id = self.zappa.get_api_id(self.lambda_name)
        for api_key in self.zappa.get_api_keys(api_id, self.api_stage):
            status_dict[u'API    Gateway    x-api-key'] = api_key
        domain_url = self.stage_config.get(u'domain', None)
        if domain_url:
            status_dict[u'Domain    URL'] = (u'https://' + domain_url)
        else:
            status_dict[u'Domain    URL'] = u'None    Supplied'
    event_rules = self.zappa.get_event_rules_for_lambda(lambda_arn=self.lambda_arn)
    status_dict[u'Num.    Event    Rules'] = len(event_rules)
    if (len(event_rules) > 0):
        status_dict[u'Events'] = []
    for rule in event_rules:
        event_dict = {}
        rule_name = rule[u'Name']
        event_dict[u'Event    Rule    Name'] = rule_name
        event_dict[u'Event    Rule    Schedule'] = rule.get(u'ScheduleExpression', None)
        event_dict[u'Event    Rule    State'] = rule.get(u'State', None).title()
        event_dict[u'Event    Rule    ARN'] = rule.get(u'Arn', None)
        status_dict[u'Events'].append(event_dict)
    if return_json:
        print json.dumpsJSON(status_dict)
    else:
        click.echo(((u'Status    for    ' + click.style(self.lambda_name, bold=True)) + u':    '))
        for (k, v) in status_dict.items():
            if (k == u'Events'):
                for event in v:
                    for (item_k, item_v) in event.items():
                        tabular_print(item_k, item_v)
            else:
                tabular_print(k, v)
    return True
