@staticmethod
def get_custom_spec_interface(dhcp, ip=None, mask=None, gateway=None):
    """
        Generates an interface object definition for a
        customization specification :py:func:`get_custom_spec`

        :param dhcp: Whether the virtual machine acquires IP config from
         DHCP. If set to true, parameters ip, subnet dns and gateway will
         be ignored.
        :type dhcp: bool
        :param ip: Specification to obtain a unique IP address
         for this virtual network adapter.
        :type ip: str
        :param mask: Subnet mask for this virtual network adapter.
        :type mask: str
        :param gateway: For a virtual network adapter with a static IP address,
         this data object type contains a list of gateways,
         in order of preference.
        :type gateway: list
        :return:
        """
    interface = dict(dhcp=dhcp)
    if not dhcp:
        fixed_ip = dict(ip=ip, mask=mask, gateway=gateway)
        interface.update(fixed_ip)
    return interface
