
    S                     `    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZdZ	dZ
dZd	 Zd
 Zy)z0Common utility functions for network operations.    )absolute_import)division)unicode_literals)timesN      c                     	 t        j                  t        j                  |             j                  }|t
        t        fvrt        d      |S # t        $ r	 t        cY S w xY w)zGiven an ip address, determine IP version.

  Args:
    ip_address: string, IP address to test IP version of

  Returns:
    int, the IP version if it could be determined or IP_VERSION_UNKNOWN
    otherwise.
  z#Reported IP version not recognized.)		ipaddress
ip_addresssix	text_typeversionIP_VERSION_4IP_VERSION_6
ValueErrorIP_VERSION_UNKNOWN)r   r   s     )lib/googlecloudsdk/api_lib/sql/network.pyGetIpVersionr      sY    ""3==#<=EEG|\22<==N	 s   AA A! A!c                  J    t        j                  t         j                        S )z!Returns the current UTC datetime.)tzinfo)r   NowUTC     r   GetCurrentTimer   2   s    	%))	$$r   )__doc__
__future__r   r   r   googlecloudsdk.core.utilr   r
   r   r   r   r   r   r   r   r   r   <module>r      s6    7 &  ' *  
 (%r   