parameters: (pathset)
return_statement: return b''.join(paths_as_bytes)
docstring: Serialize a PathSet, which is an array of arrays,
      where each inner array represents one possible payment path.
      A path consists of "path step" objects in sequence, each with one or
      more of "account", "currency", and "issuer" fields, plus (ignored) "type"
      and "type_hex" fields which indicate which fields are present.
      (We re-create the type field for serialization based on which of the core
      3 fields are present.)
docstring_summary: Serialize a PathSet, which is an array of arrays,
      where each inner array represents one possible payment path.
      A path consists of "path step" objects in sequence, each with one or
      more of "account", "currency", and "issuer" fields, plus (ignored) "type"
      and "type_hex" fields which indicate which fields are present.
      (We re-create the type field for serialization based on which of the core
      3 fields are present.)
docstring_tokens: Serialize a PathSet which is an array of arrays where each inner array represents one possible payment path . A path consists of path step objects in sequence each with one or more of account currency and issuer fields plus ( ignored ) type and type_hex fields which indicate which fields are present . ( We re - create the type field for serialization based on which of the core 3 fields are present . )
function: def pathset_to_bytes(pathset):
      """
      Serialize a PathSet, which is an array of arrays,
      where each inner array represents one possible payment path.
      A path consists of "path step" objects in sequence, each with one or
      more of "account", "currency", and "issuer" fields, plus (ignored) "type"
      and "type_hex" fields which indicate which fields are present.
      (We re-create the type field for serialization based on which of the core
      3 fields are present.)
      """
  
      if not len(pathset):
          raise ValueError("PathSet type must not be empty")
  
      paths_as_bytes = []
      for n in range(len(pathset)):
          path = path_as_bytes(pathset[n])
          logger.debug("Path %d:  %s"%(n, path.hex()))
          paths_as_bytes.append(path)
          if n + 1 == len(pathset): # last path; add an end byte
              paths_as_bytes.append(bytes.fromhex("00"))
          else: # add a path separator byte
              paths_as_bytes.append(bytes.fromhex("ff"))
  
      return b''.join(paths_as_bytes)
function_tokens: def pathset_to_bytes ( pathset ) : if not len ( pathset ) : raise ValueError ( "PathSet type must not be empty" ) paths_as_bytes = [ ] for n in range ( len ( pathset ) ) : path = path_as_bytes ( pathset [ n ] ) logger . debug ( "Path %d:  %s" % ( n , path . hex ( ) ) ) paths_as_bytes . append ( path ) if n + 1 == len ( pathset ) : # last path; add an end byte paths_as_bytes . append ( bytes . fromhex ( "00" ) ) else : # add a path separator byte paths_as_bytes . append ( bytes . fromhex ( "ff" ) ) return b'' . join ( paths_as_bytes )