import socket


def getfqdn4(name=None):
    """return (a) IPv4 FQDN (Fully Qualified Domain Name)
       if name is not given, returns local hostname"""
    if name is None:
        return socket.getfqdn()
    return socket.getfqdn(name)