code: def _align_abi_input(arg_abi, arg):
      
      tuple_parts = get_tuple_type_str_parts(arg_abi['type'])
  
      if tuple_parts is None:
          # Arg is non-tuple.  Just return value.
          return arg
  
      tuple_prefix, tuple_dims = tuple_parts
      if tuple_dims is None:
          # Arg is non-list tuple.  Each sub arg in `arg` will be aligned
          # according to its corresponding abi.
          sub_abis = arg_abi['components']
      else:
          # Arg is list tuple.  A non-list version of its abi will be used to
          # align each element in `arg`.
          new_abi = copy.copy(arg_abi)
          new_abi['type'] = tuple_prefix
  
          sub_abis = itertools.repeat(new_abi)
  
      if isinstance(arg, abc.Mapping):
          # Arg is mapping.  Align values according to abi order.
          aligned_arg = tuple(arg[abi['name']] for abi in sub_abis)
      else:
          aligned_arg = arg
  
      if not is_list_like(aligned_arg):
          raise TypeError(
              'Expected non-string sequence for "{}" component type: got {}'.format(
                  arg_abi['type'],
                  aligned_arg,
              ),
          )
  
      return type(aligned_arg)(
          _align_abi_input(sub_abi, sub_arg)
          for sub_abi, sub_arg in zip(sub_abis, aligned_arg)
      )
docs: Aligns the values of any mapping at any level of nesting in ``arg``
      according to the layout of the corresponding abi spec.