  def _CreateNetworkInterfaceElements(
      self,
      name_prefix: str,
      region: Optional[str] = None) -> Tuple[Any, ...]:
    """Creates required elements for creating a network interface.

    Args:
      name_prefix (str): A name prefix to use for the network interface
          elements to create.
      region (str): Optional. The region in which to create the elements.
          Default uses default_region of the AZAccount object.

    Returns:
      Tuple[Any, Any, Any, Any]: A tuple containing a public IP address object,
          a virtual network object, a subnet object and a network security
          group object.

    Raises:
      ResourceCreationError: If the elements could not be created.
    """

    if not region:
      region = self.az_account.default_region

    # IP address
    public_ip_name = '{0:s}-public-ip'.format(name_prefix)
    # Virtual Network
    vnet_name = '{0:s}-vnet'.format(name_prefix)
    # Subnet
    subnet_name = '{0:s}-subnet'.format(name_prefix)
    # Network security group
    nsg_name = '{0:s}-nsg'.format(name_prefix)

    client_to_creation_data = {
        self.network_client.public_ip_addresses: {
            'resource_group_name': self.az_account.default_resource_group_name,
            'public_ip_address_name': public_ip_name,
            'parameters': {
                'location': region,
                'public_ip_allocation_method': 'Dynamic'
            }
        },
        self.network_client.virtual_networks: {
            'resource_group_name': self.az_account.default_resource_group_name,
            'virtual_network_name': vnet_name,
            'parameters': {
                'location': region,
                'address_space': {'address_prefixes': ['10.0.0.0/16']}
            }
        },
        self.network_client.subnets: {
            'resource_group_name': self.az_account.default_resource_group_name,
            'virtual_network_name': vnet_name,
            'subnet_name': subnet_name,
            'subnet_parameters': {'address_prefix': '10.0.0.0/24'}
        },
        self.network_client.network_security_groups: {
            'resource_group_name': self.az_account.default_resource_group_name,
            'network_security_group_name': nsg_name,
            'parameters': {
                'location': region,
                # Allow SSH traffic
                'security_rules': [{
                    'name': 'Allow-SSH',
                    'direction': 'Inbound',
                    'protocol': 'TCP',
                    'source_address_prefix': '*',
                    'destination_address_prefix': '*',
                    'source_port_range': '*',
                    'destination_port_range': 22,
                    'access': 'Allow',
                    'priority': 300
                }]
            }
        }
    }  # type: Dict[str, Any]

    result = []
    try:
      for client, data in client_to_creation_data.items():
        request = common.ExecuteRequest(
            client,
            'begin_create_or_update',
            data)[0]
        request.wait()
        result.append(request.result())
    except azure_exceptions.AzureError as exception:
      raise errors.ResourceCreationError(
          'Could not create network interface elements: {0!s}'.format(
              exception), __name__) from exception
    return tuple(result)
Creates required elements for creating a network interface.

Args:
name_prefix (str): A name prefix to use for the network interface
elements to create.
region (str): Optional. The region in which to create the elements.
Default uses default_region of the AZAccount object.

Returns:
Tuple[Any, Any, Any, Any]: A tuple containing a public IP address object,
a virtual network object, a subnet object and a network security
group object.

Raises:
ResourceCreationError: If the elements could not be created.
libcloudforensics/providers/azure/internal/network.py