from datetime import datetime
from pprint import pformat
from re import search as re_search
from re import sub as re_sub


class FFApi:
        def __init__(self, content):
            self.c = content

        def pull(self, *fields):
            c = self.c
            for f in fields:
                if isinstance(c, dict) and f in c.keys():
                    if f == fields[-1]:
                        return c[f]
                    c = c[f]

        def push(self, value, *fields):
            c = self.c
            for f in fields:
                if isinstance(c, dict) and f in c.keys():
                    if f == fields[-1]:
                        c[f] = value
                    c = c[f]

        def timestamp(self):
            if self.pull('state', 'lastchange') is not None:
                self.push(api_timestamp(), 'state', 'lastchange')

        def show(self):
            return pformat(self.c)


def api_timestamp(dt=None):
    if not dt:
        dt = datetime.now()
    return dt.isoformat('T')


def api_descr(rx, replace, text):
    match = (
        False if not (rx and text) else re_search(rx, text)
    )
    if match and replace:
        text = re_sub(rx, replace, text)
    return text

from datetime import datetime
from pprint import pformat
from re import search as re_search
from re import sub as re_sub


class FFApi:
    def __init__(self, content):
        self.c = content

    def pull(self, *fields):
        c = self.c
        for f in fields:
            if isinstance(c, dict) and f in c.keys():
                if f == fields[-1]:
                    return c[f]
                c = c[f]

    def push(self, value, *fields):
        c = self.c
        for f in fields:
            if isinstance(c, dict) and f in c.keys():
                if f == fields[-1]:
                    c[f] = value
                c = c[f]

    def timestamp(self):
        if self.pull('state', 'lastchange') is not None:
            self.push(api_timestamp(), 'state', 'lastchange')

    def show(self):
        return pformat(self.c)


def api_timestamp(dt=None):
    if not dt:
        dt = datetime.now()
    return dt.isoformat('T')


def api_descr(rx, replace, text):
    match = (
        False if not (rx and text) else re_search(rx, text)
    )
    if match and replace:
        text = re_sub(rx, replace, text)
    return text

Fix double indentation error in FFApi class
Fix double indentation error in FFApi class

  from datetime import datetime
  from pprint import pformat
  from re import search as re_search
  from re import sub as re_sub
  
  
  class FFApi:
-         def __init__(self, content):
+     def __init__(self, content):
-             self.c = content
+         self.c = content
  
-         def pull(self, *fields):
+     def pull(self, *fields):
-             c = self.c
+         c = self.c
-             for f in fields:
+         for f in fields:
-                 if isinstance(c, dict) and f in c.keys():
+             if isinstance(c, dict) and f in c.keys():
-                     if f == fields[-1]:
+                 if f == fields[-1]:
-                         return c[f]
+                     return c[f]
-                     c = c[f]
+                 c = c[f]
  
-         def push(self, value, *fields):
+     def push(self, value, *fields):
-             c = self.c
+         c = self.c
-             for f in fields:
+         for f in fields:
-                 if isinstance(c, dict) and f in c.keys():
+             if isinstance(c, dict) and f in c.keys():
-                     if f == fields[-1]:
+                 if f == fields[-1]:
-                         c[f] = value
+                     c[f] = value
-                     c = c[f]
+                 c = c[f]
  
-         def timestamp(self):
+     def timestamp(self):
-             if self.pull('state', 'lastchange') is not None:
+         if self.pull('state', 'lastchange') is not None:
-                 self.push(api_timestamp(), 'state', 'lastchange')
+             self.push(api_timestamp(), 'state', 'lastchange')
  
-         def show(self):
+     def show(self):
-             return pformat(self.c)
+         return pformat(self.c)
  
  
  def api_timestamp(dt=None):
      if not dt:
          dt = datetime.now()
      return dt.isoformat('T')
  
  
  def api_descr(rx, replace, text):
      match = (
          False if not (rx and text) else re_search(rx, text)
      )
      if match and replace:
          text = re_sub(rx, replace, text)
      return text
  
Fix double indentation error in FFApi class
## Code Before:
from datetime import datetime
from pprint import pformat
from re import search as re_search
from re import sub as re_sub


class FFApi:
        def __init__(self, content):
            self.c = content

        def pull(self, *fields):
            c = self.c
            for f in fields:
                if isinstance(c, dict) and f in c.keys():
                    if f == fields[-1]:
                        return c[f]
                    c = c[f]

        def push(self, value, *fields):
            c = self.c
            for f in fields:
                if isinstance(c, dict) and f in c.keys():
                    if f == fields[-1]:
                        c[f] = value
                    c = c[f]

        def timestamp(self):
            if self.pull('state', 'lastchange') is not None:
                self.push(api_timestamp(), 'state', 'lastchange')

        def show(self):
            return pformat(self.c)


def api_timestamp(dt=None):
    if not dt:
        dt = datetime.now()
    return dt.isoformat('T')


def api_descr(rx, replace, text):
    match = (
        False if not (rx and text) else re_search(rx, text)
    )
    if match and replace:
        text = re_sub(rx, replace, text)
    return text

## Instruction:
Fix double indentation error in FFApi class
## Code After:
from datetime import datetime
from pprint import pformat
from re import search as re_search
from re import sub as re_sub


class FFApi:
    def __init__(self, content):
        self.c = content

    def pull(self, *fields):
        c = self.c
        for f in fields:
            if isinstance(c, dict) and f in c.keys():
                if f == fields[-1]:
                    return c[f]
                c = c[f]

    def push(self, value, *fields):
        c = self.c
        for f in fields:
            if isinstance(c, dict) and f in c.keys():
                if f == fields[-1]:
                    c[f] = value
                c = c[f]

    def timestamp(self):
        if self.pull('state', 'lastchange') is not None:
            self.push(api_timestamp(), 'state', 'lastchange')

    def show(self):
        return pformat(self.c)


def api_timestamp(dt=None):
    if not dt:
        dt = datetime.now()
    return dt.isoformat('T')


def api_descr(rx, replace, text):
    match = (
        False if not (rx and text) else re_search(rx, text)
    )
    if match and replace:
        text = re_sub(rx, replace, text)
    return text
