def clean_time(self, time):
        """
        Transform time field to datetime object if there is any.
        """
        if isinstance(time, int):
            time = datetime.utcfromtimestamp(time)
        elif isinstance(time, str):
            time = parser.parse(time)

        return time
def clean_time ( self , time ) : if isinstance ( time , int ) : time = datetime . utcfromtimestamp ( time ) elif isinstance ( time , str ) : time = parser . parse ( time ) return time
Transform time field to datetime object if there is any.