Pseudocode algorithm to check encoding of Turing machine
The encoding $\langle M \rangle$ of a TM, has a specific structure. All you need your algorithm to do, is to verify that the input string $w$ possesses the "correct" structure of a valid encoding.

Note, that there are many possible ways to define the encoding $\langle M \rangle$. For instance one possible such encoding, for $M=(Q,q_0,F,\Gamma,\Sigma, \sqcup, \delta)$ is 
$$ 1^{|Q|}01^{|\Gamma|}01^{|\Sigma|}0\delta_100\delta_200 \ldots \delta_{last}000$$
where each $\delta_i$ is one line of the transition function, such that if, for instance $\delta(q,a) = \{ p, b, d\}$ we encode it as $1^q01^a01^p01^b01^d$ with $d$ being the direction where the head moves, say Left=1, Right=2, Stay=3.

Remember that other encodings are possible, it depends on your definition!

However, assuming the above definition, I think you should be able to come up with an algorithm to verify if the encoding is valid or not.

For instance, is the input $w=0000000$ valid ?  


   no, because it contains no states $Q$, etc.


What will you need to check for validity? Basically, only the following


   0. that the formatting looks correct (no extra characters, ends with 000, etc,)
 1. that all the sets exist (and behave correctly, e.g., $|\Gamma|&gt;|\Sigma|$)
 2. that $\delta$ is well defined (think, what does this mean)...