# encoding: utf-8

from __future__ import absolute_import, unicode_literals

from dataproperty import Align

from ._font import FontSize


class Style(object):
    @property
    def align(self):
        return self.__align

    @property
    def font_size(self):
        return self.__font_size

    def __init__(self, **kwargs):
        self.__align = kwargs.pop("align", None)
        if self.__align is not None and not isinstance(self.__align, Align):
            return TypeError("align must be a pytablewriter.style.Align instancce")

        self.__font_size = kwargs.pop("font_size", FontSize.NONE)
        if self.__font_size is not None and not isinstance(self.__font_size, FontSize):
            return TypeError("align must be a pytablewriter.style.FontSize instancce")

    def __repr__(self):
        return "{}".format(self.font_size)

    def __eq__(self, other):
        if self.__class__ is not other.__class__:
            return NotImplemented

        return all([self.align == other.align, self.font_size == other.font_size])

    def __ne__(self, other):
        equal = self.__eq__(other)
        return NotImplemented if equal is NotImplemented else not equal

@@ -384,159 +384,43 @@
     
-if 
 self.__
+v
 ali
-gn is not None and not isinstance(self.__align, Align):%0A            return TypeError(%22align must be a pytablewriter.style.Align instancce%22
+date_attr(%22align%22, Align
 )%0A%0A 
@@ -496,66 +496,30 @@
     
-if 
 self.__
-font_size is not None and not isinstance(self.__
+validate_attr(%22
 font
@@ -523,16 +523,17 @@
 ont_size
+%22
 , FontSi
@@ -539,96 +539,8 @@
 ize)
-:%0A            return TypeError(%22align must be a pytablewriter.style.FontSize instancce%22)
 %0A%0A  
@@ -939,8 +939,266 @@
 t equal%0A
+%0A    def __validate_attr(self, attr_name, expected_type):%0A        value = getattr(self, attr_name)%0A        if value is not None and not isinstance(value, expected_type):%0A            raise TypeError(%22align must be a %7B%7D instancce%22.format(type(expected_type)))%0A

Fix arguments validation