def get_ip_from_host_name(name):
    """Extract ip from host name.

    Host name is in this form: ip-xxx-xxx-xxx-xxx.ec2.internal

    Args:
        name (string): Host name.

    Returns:
        (string): ip address in xxx.xxx.xxx.xxx form.
    """
    parts = name.split('-')
    last_octet = parts[4].split('.')[0]
    ip = parts[1] + '.' + parts[2] + '.' + parts[3] + '.' + last_octet
    return ip