def base_prompt(self, prompt):
        """Extract the base prompt pattern."""
        if prompt is None:
            return None
        if not self.device.is_target:
            return prompt
        pattern = pattern_manager.pattern(self.platform, "prompt_dynamic", compiled=False)
        pattern = pattern.format(prompt="(?P<prompt>.*?)")
        result = re.search(pattern, prompt)
        if result:
            base = result.group("prompt") + "#"
            self.log("base prompt: {}".format(base))
            return base
        else:
            self.log("Unable to extract the base prompt")
            return prompt
Extract the base prompt pattern.