def _mock_gethostbyname_ex(aliaslist=None, ipaddrlist=None):
    """Returns a mocked socket.gethostbyname_ex function for testing use
    """
    if aliaslist is None:
        aliaslist = []
    if ipaddrlist is None:
        ipaddrlist = ['127.0.0.1']
    return lambda hostname: (hostname, aliaslist, ipaddrlist)