'Get the error code from the error_value accounting for Python
version differences.
:rtype: int'

@staticmethod
def _get_error_code(error_value):

    if (not error_value):
        return None
    if hasattr(error_value, 'errno'):
        return error_value.errno
    else:
        return error_value[0]
