code: def get_child_for_path(self, path):
          
          path = ensure_str(path)
  
          if not path:
              raise InvalidPathError("%s is not a valid path" % path)
  
          # Figure out public/private derivation
          as_private = True
          if path.startswith("M"):
              as_private = False
          if path.endswith(".pub"):
              as_private = False
              path = path[:-4]
  
          parts = path.split("/")
          if len(parts) == 0:
              raise InvalidPathError()
  
          child = self
          for part in parts:
              if part.lower() == "m":
                  continue
              is_prime = None  # Let primeness be figured out by the child number
              if part[-1] in "'p":
                  is_prime = True
                  part = part.replace("'", "").replace("p", "")
              try:
                  child_number = long_or_int(part)
              except ValueError:
                  raise InvalidPathError("%s is not a valid path" % path)
              child = child.get_child(child_number, is_prime)
          if not as_private:
              return child.public_copy()
          return child
docs: Get a child for a given path.
  
          Rather than repeated calls to get_child, children can be found
          by a derivation path. Paths look like:
  
              m/0/1'/10
  
          Which is the same as
  
              self.get_child(0).get_child(-1).get_child(10)
  
          Or, in other words, the 10th publicly derived child of the 1st
          privately derived child of the 0th publicly derived child of master.
  
          You can use either ' or p to denote a prime (that is, privately
          derived) child.
  
          A child that has had its private key stripped can be requested by
          either passing a capital M or appending '.pub' to the end of the path.
          These three paths all give the same child that has had its private
          key scrubbed:
  
              M/0/1
              m/0/1.pub
              M/0/1.pub